當前位置: 首頁>>代碼示例>>Python>>正文


Python subsub.spam方法代碼示例

本文整理匯總了Python中t2.sub.subsub.spam方法的典型用法代碼示例。如果您正苦於以下問題:Python subsub.spam方法的具體用法?Python subsub.spam怎麽用?Python subsub.spam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在t2.sub.subsub的用法示例。


在下文中一共展示了subsub.spam方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_4

# 需要導入模塊: from t2.sub import subsub [as 別名]
# 或者: from t2.sub.subsub import spam [as 別名]
def test_4(self):
        hier = [
        ("t4.py", "raise RuntimeError('Shouldnt load t4.py')"),
        ("t4", None),
        ("t4 __init__"+os.extsep+"py", ""),
        ("t4 sub.py", "raise RuntimeError('Shouldnt load sub.py')"),
        ("t4 sub", None),
        ("t4 sub __init__"+os.extsep+"py", ""),
        ("t4 sub subsub"+os.extsep+"py",
         "raise RuntimeError('Shouldnt load subsub.py')"),
        ("t4 sub subsub", None),
        ("t4 sub subsub __init__"+os.extsep+"py", "spam = 1"),
               ]
        self.mkhier(hier)

        s = """
            from t4.sub.subsub import *
            self.assertEqual(spam, 1)
            """
        self.run_code(s) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:22,代碼來源:test_pkg.py

示例2: test_6

# 需要導入模塊: from t2.sub import subsub [as 別名]
# 或者: from t2.sub.subsub import spam [as 別名]
def test_6(self):
        hier = [
                ("t6", None),
                ("t6 __init__"+os.extsep+"py",
                 "__all__ = ['spam', 'ham', 'eggs']"),
                ("t6 spam"+os.extsep+"py", ""),
                ("t6 ham"+os.extsep+"py", ""),
                ("t6 eggs"+os.extsep+"py", ""),
               ]
        self.mkhier(hier)

        import t6
        self.assertEqual(fixdir(dir(t6)),
                         ['__all__', '__doc__', '__file__',
                          '__name__', '__package__', '__path__'])
        s = """
            import t6
            from t6 import *
            self.assertEqual(fixdir(dir(t6)),
                             ['__all__', '__doc__', '__file__',
                              '__name__', '__package__', '__path__',
                              'eggs', 'ham', 'spam'])
            self.assertEqual(dir(), ['eggs', 'ham', 'self', 'spam', 't6'])
            """
        self.run_code(s) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:27,代碼來源:test_pkg.py

示例3: test_4

# 需要導入模塊: from t2.sub import subsub [as 別名]
# 或者: from t2.sub.subsub import spam [as 別名]
def test_4(self):
        hier = [
        ("t4.py", "raise RuntimeError('Shouldnt load t4.py')"),
        ("t4", None),
        ("t4 __init__.py", ""),
        ("t4 sub.py", "raise RuntimeError('Shouldnt load sub.py')"),
        ("t4 sub", None),
        ("t4 sub __init__.py", ""),
        ("t4 sub subsub.py",
         "raise RuntimeError('Shouldnt load subsub.py')"),
        ("t4 sub subsub", None),
        ("t4 sub subsub __init__.py", "spam = 1"),
               ]
        self.mkhier(hier)

        s = """
            from t4.sub.subsub import *
            self.assertEqual(spam, 1)
            """
        self.run_code(s) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:22,代碼來源:test_pkg.py

示例4: test_3

# 需要導入模塊: from t2.sub import subsub [as 別名]
# 或者: from t2.sub.subsub import spam [as 別名]
def test_3(self):
        hier = [
                ("t3", None),
                ("t3 __init__"+os.extsep+"py", ""),
                ("t3 sub", None),
                ("t3 sub __init__"+os.extsep+"py", ""),
                ("t3 sub subsub", None),
                ("t3 sub subsub __init__"+os.extsep+"py", "spam = 1"),
               ]
        self.mkhier(hier)

        import t3.sub.subsub
        self.assertEqual(t3.__name__, "t3")
        self.assertEqual(t3.sub.__name__, "t3.sub")
        self.assertEqual(t3.sub.subsub.__name__, "t3.sub.subsub") 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:17,代碼來源:test_pkg.py

示例5: test_5

# 需要導入模塊: from t2.sub import subsub [as 別名]
# 或者: from t2.sub.subsub import spam [as 別名]
def test_5(self):
        hier = [
        ("t5", None),
        ("t5 __init__"+os.extsep+"py", "import t5.foo"),
        ("t5 string"+os.extsep+"py", "spam = 1"),
        ("t5 foo"+os.extsep+"py",
         "from . import string; assert string.spam == 1"),
         ]
        self.mkhier(hier)

        import t5
        s = """
            from t5 import *
            self.assertEqual(dir(), ['foo', 'self', 'string', 't5'])
            """
        self.run_code(s)

        import t5
        self.assertEqual(fixdir(dir(t5)),
                         ['__doc__', '__file__', '__name__',
                          '__package__', '__path__', 'foo', 'string', 't5'])
        self.assertEqual(fixdir(dir(t5.foo)),
                         ['__doc__', '__file__', '__name__', '__package__',
                          'string'])
        self.assertEqual(fixdir(dir(t5.string)),
                         ['__doc__', '__file__', '__name__','__package__',
                          'spam']) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:29,代碼來源:test_pkg.py

示例6: test_3

# 需要導入模塊: from t2.sub import subsub [as 別名]
# 或者: from t2.sub.subsub import spam [as 別名]
def test_3(self):
        hier = [
                ("t3", None),
                ("t3 __init__.py", ""),
                ("t3 sub", None),
                ("t3 sub __init__.py", ""),
                ("t3 sub subsub", None),
                ("t3 sub subsub __init__.py", "spam = 1"),
               ]
        self.mkhier(hier)

        import t3.sub.subsub
        self.assertEqual(t3.__name__, "t3")
        self.assertEqual(t3.sub.__name__, "t3.sub")
        self.assertEqual(t3.sub.subsub.__name__, "t3.sub.subsub") 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:17,代碼來源:test_pkg.py

示例7: test_5

# 需要導入模塊: from t2.sub import subsub [as 別名]
# 或者: from t2.sub.subsub import spam [as 別名]
def test_5(self):
        hier = [
        ("t5", None),
        ("t5 __init__.py", "import t5.foo"),
        ("t5 string.py", "spam = 1"),
        ("t5 foo.py",
         "from . import string; assert string.spam == 1"),
         ]
        self.mkhier(hier)

        import t5
        s = """
            from t5 import *
            self.assertEqual(dir(), ['foo', 'self', 'string', 't5'])
            """
        self.run_code(s)

        import t5
        self.assertEqual(fixdir(dir(t5)),
                         ['__cached__', '__doc__', '__file__', '__loader__',
                          '__name__', '__package__', '__path__', '__spec__',
                          'foo', 'string', 't5'])
        self.assertEqual(fixdir(dir(t5.foo)),
                         ['__cached__', '__doc__', '__file__', '__loader__',
                          '__name__', '__package__', '__spec__', 'string'])
        self.assertEqual(fixdir(dir(t5.string)),
                         ['__cached__', '__doc__', '__file__', '__loader__',
                          '__name__', '__package__', '__spec__', 'spam']) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:30,代碼來源:test_pkg.py

示例8: test_6

# 需要導入模塊: from t2.sub import subsub [as 別名]
# 或者: from t2.sub.subsub import spam [as 別名]
def test_6(self):
        hier = [
                ("t6", None),
                ("t6 __init__.py",
                 "__all__ = ['spam', 'ham', 'eggs']"),
                ("t6 spam.py", ""),
                ("t6 ham.py", ""),
                ("t6 eggs.py", ""),
               ]
        self.mkhier(hier)

        import t6
        self.assertEqual(fixdir(dir(t6)),
                         ['__all__', '__cached__', '__doc__', '__file__',
                          '__loader__', '__name__', '__package__', '__path__',
                          '__spec__'])
        s = """
            import t6
            from t6 import *
            self.assertEqual(fixdir(dir(t6)),
                             ['__all__', '__cached__', '__doc__', '__file__',
                              '__loader__', '__name__', '__package__',
                              '__path__', '__spec__', 'eggs', 'ham', 'spam'])
            self.assertEqual(dir(), ['eggs', 'ham', 'self', 'spam', 't6'])
            """
        self.run_code(s) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:28,代碼來源:test_pkg.py


注:本文中的t2.sub.subsub.spam方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。