def test_remove_imports_in_function(): result = remove_imports(TEST_SOURCE_3) # test function should have 3 lines (including the comment) assert len(result.split('\n')[1:-1]) == 3 assert 'def foo():' in result assert '# a comment in a function' in result assert 'bar()' in result
def test_remove_imports(): result = remove_imports(TEST_SOURCE_2) assert 'foo_bar()' in result