Ejemplo n.º 1
0
 def test_package_resolution_simple_with_context(self):
     from example import application
     with application.app_context():
         assert models._package_of('example.models') == 'example'
Ejemplo n.º 2
0
 def test_package_resolution_simple_no_context(self):
     assert models._package_of('example.models') == 'example'
Ejemplo n.º 3
0
 def test_package_resolution_nested_with_context(self):
     from a import application
     with application.app_context():
         assert models._package_of('a.models') == 'a'
         assert models._package_of('a.b.models') == 'a.b'
         assert models._package_of('a.b.c.models') == 'a.b'
Ejemplo n.º 4
0
 def test_package_resolution_nested_no_context(self):
     assert models._package_of('a.models') == 'a'
     assert models._package_of('a.b.models') == 'a.b'
     assert models._package_of('a.b') == 'a.b'
     assert models._package_of('a.b.c.models') == 'a.b.c'
     assert models._package_of('a.b.c.models.models') == 'a.b.c'