def test_package_subpackage():
    compilePackage("subPackage", { "__init__.py" : "import a\nimport b.c\ndef f(): return a.f() + b.c.f()",
                                   "a.py" : "def f(): return 10",
                                   "b\\__init__.py" : "def f(): return 'kthxbye'",
                                   "b\\c.py" : "def f(): return 20"})

    import subPackage
    AreEqual(subPackage.f(), 30)
    AreEqual(subPackage.b.f(), 'kthxbye')    
    AreEqual(subPackage.b.c.f(), 20)
Beispiel #2
0
    def test_package_subpackage(self):
        self.compilePackage("subPackage", { "__init__.py" : "import a\nimport b.c\ndef f(): return a.f() + b.c.f()",
                                    "a.py" : "def f(): return 10",
                                    "b/__init__.py" : "def f(): return 'kthxbye'",
                                    "b/c.py" : "def f(): return 20"})

        import subPackage
        self.assertEqual(subPackage.f(), 30)
        self.assertEqual(subPackage.b.f(), 'kthxbye')    
        self.assertEqual(subPackage.b.c.f(), 20)
def test_package_subpackage():
    compilePackage("subPackage", { "__init__.py" : "import a\nimport b.c\ndef f(): return a.f() + b.c.f()",
                                   "a.py" : "def f(): return 10",
                                   "b\\__init__.py" : "def f(): return 'kthxbye'",
                                   "b\\c.py" : "def f(): return 20"})

    import subPackage
    AreEqual(subPackage.f(), 30)
    AreEqual(subPackage.b.f(), 'kthxbye')    
    AreEqual(subPackage.b.c.f(), 20)
    def test_package_subpackage(self):
        self.compilePackage("subPackage", { "__init__.py" : "import a\nimport b.c\ndef f(): return a.f() + b.c.f()",
                                    "a.py" : "def f(): return 10",
                                    "b/__init__.py" : "def f(): return 'kthxbye'",
                                    "b/c.py" : "def f(): return 20"})

        import subPackage
        self.assertEqual(subPackage.f(), 30)
        self.assertEqual(subPackage.b.f(), 'kthxbye')    
        self.assertEqual(subPackage.b.c.f(), 20)