Skip to content

Commit 455a86d

Browse files
committed
exact test
1 parent cc0034b commit 455a86d

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

tests/test_add_needed_imports_from_module.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,8 @@ def test_dotted_import_collector_skips_star_imports():
435435
module.visit(collector)
436436

437437
# Should collect regular imports but skip the star import
438-
expected_imports = {
439-
'pathlib.Path',
440-
'collections.defaultdict',
441-
'os'
442-
}
438+
expected_imports = {'collections.defaultdict', 'os', 'pathlib.Path'}
443439
assert collector.imports == expected_imports
444-
# Ensure the star import from typing is not collected
445-
assert not any('typing' in imp for imp in collector.imports)
446440

447441

448442
def test_add_needed_imports_with_star_import_resolution():
@@ -489,6 +483,11 @@ def my_function():
489483
)
490484

491485
# The result should have individual imports instead of star import
492-
assert 'from source_module import' in result
493-
assert 'HelperClass' in result and 'UtilFunction' in result
494-
assert 'from source_module import *' not in result
486+
expected_result = '''from source_module import HelperClass, UtilFunction
487+
488+
def my_function():
489+
helper = HelperClass()
490+
UtilFunction()
491+
return helper
492+
'''
493+
assert result == expected_result

0 commit comments

Comments
 (0)