def test_package_resolution_simple_with_context(self): from example import application with application.app_context(): assert models._package_of('example.models') == 'example'
def test_package_resolution_simple_no_context(self): assert models._package_of('example.models') == 'example'
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'
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'