@@ -406,6 +406,42 @@ def test_multiple_files_with_aliases(self):
406
406
for node , expected_label in zip (self .cfg .nodes , EXPECTED ):
407
407
self .assertEqual (node .label , expected_label )
408
408
409
+ def test_from_multiple_files_with_aliases (self ):
410
+ """Make sure that when two functions are imported that have the same name, they are aliased correctly."""
411
+ file_path = os .path .normpath ('examples/import_test_project/test_from_multiple_files_with_aliases.py' )
412
+ project_path = os .path .normpath ('examples/import_test_project' )
413
+
414
+ project_modules = get_modules_and_packages (project_path )
415
+ local_modules = get_directory_modules (project_path )
416
+
417
+ self .cfg_create_from_file (file_path , project_modules , local_modules )
418
+
419
+ EXPECTED = ["Entry module" ,
420
+ "Module Entry multiple_files.C" ,
421
+ "Module Exit multiple_files.C" ,
422
+ "Module Entry multiple_files.D" ,
423
+ "Module Exit multiple_files.D" ,
424
+ "temp_1_s = 'from_c'" ,
425
+ "s = temp_1_s" ,
426
+ "Function Entry foo" ,
427
+ "ret_foo_c = s + 'see'" ,
428
+ "Exit foo" ,
429
+ "~call_1 = ret_foo_c" ,
430
+ "c = ~call_1" ,
431
+ "save_2_c = c" ,
432
+ "temp_2_s = 'from_d'" ,
433
+ "s = temp_2_s" ,
434
+ "Function Entry foo" ,
435
+ "ret_foo_d = s + 'dee'" ,
436
+ "Exit foo" ,
437
+ "c = save_2_c" ,
438
+ "~call_2 = ret_foo_d" ,
439
+ "d = ~call_2" ,
440
+ "Exit module" ]
441
+
442
+ for node , expected_label in zip (self .cfg .nodes , EXPECTED ):
443
+ self .assertEqual (node .label , expected_label )
444
+
409
445
def test_multiple_functions_with_aliases (self ):
410
446
file_path = os .path .normpath ('examples/import_test_project/test_multiple_functions_with_aliases.py' )
411
447
project_path = os .path .normpath ('examples/import_test_project' )
0 commit comments