def test_find_imported_modules4(): "freeze.find_imported_modules() Should filter the module path when it has more than one level" # Given the following snippet code = ''' from .relative import stuff ''' # When I query the imported modules names = freeze.find_imported_modules(code) # Then I see that the result names match the imported modules in # the code, skipping the local modules (.) names.should.equal([])
def test_find_imported_modules4(): "freeze.find_imported_modules() Should filter the module path when it has more than one level" # Given the following snipet code = ''' from .relative import stuff ''' # When I query the imported modules names = freeze.find_imported_modules(code) # Then I see that the result names match the imported modules in # the code, skipping the local modules (.) names.should.equal([])
def test_find_imported_modules3(): "freeze.find_imported_modules() Should skip any local imports (from . import x)" # Given the following snipet code = ''' from . import Image import functools ''' # When I query the imported modules names = freeze.find_imported_modules(code) # Then I see that the result names match the imported modules in # the code, skipping the local modules (.) names.should.equal(['functools'])
def test_find_imported_modules3(): "freeze.find_imported_modules() Should skip any local imports (from . import x)" # Given the following snippet code = ''' from . import Image import functools ''' # When I query the imported modules names = freeze.find_imported_modules(code) # Then I see that the result names match the imported modules in # the code, skipping the local modules (.) names.should.equal(['functools'])
def test_find_imported_modules2(): "freeze.find_imported_modules() Should also find imports declared with 'from x import y' syntax" # Given the following snipet code = ''' from PIL import Image def blah(): pass import functools print(curdling) ''' # When I query the imported modules names = freeze.find_imported_modules(code) # Then I see that the result names match the imported modules in # the code names.should.equal(['PIL', 'functools'])
def test_find_imported_modules(): "freeze.find_imported_modules() Should find all the imported modules in a string with Python code" # Given the following snipet code = ''' import curdling def blah(): pass import math print(curdling) ''' # When I query the imported modules names = freeze.find_imported_modules(code) # Then I see that the result names match the imported modules in # the code names.should.equal(['curdling', 'math'])
def test_find_imported_modules2(): "freeze.find_imported_modules() Should also find imports declared with 'from x import y' syntax" # Given the following snippet code = ''' from PIL import Image def blah(): pass import functools print(curdling) ''' # When I query the imported modules names = freeze.find_imported_modules(code) # Then I see that the result names match the imported modules in # the code names.should.equal(['PIL', 'functools'])
def test_find_imported_modules(): "freeze.find_imported_modules() Should find all the imported modules in a string with Python code" # Given the following snippet code = ''' import curdling def blah(): pass import math print(curdling) ''' # When I query the imported modules names = freeze.find_imported_modules(code) # Then I see that the result names match the imported modules in # the code names.should.equal(['curdling', 'math'])