@@ -999,7 +999,9 @@ class substr(str):
999
999
""" )
1000
1000
popen = script_helper .spawn_python ("main.py" , cwd = tmp )
1001
1001
stdout , stderr = popen .communicate ()
1002
- for line in stdout .splitlines ():
1002
+ lines = stdout .splitlines ()
1003
+ self .assertEqual (len (lines ), 3 )
1004
+ for line in lines :
1003
1005
self .assertEqual (line , b"module 'fractions' has no attribute 'Fraction'" )
1004
1006
1005
1007
with open (os .path .join (tmp , "main.py" ), "w" , encoding = 'utf-8' ) as f :
@@ -1028,7 +1030,9 @@ class substr(str):
1028
1030
""" )
1029
1031
popen = script_helper .spawn_python ("main.py" , cwd = tmp )
1030
1032
stdout , stderr = popen .communicate ()
1031
- for line in stdout .splitlines ():
1033
+ lines = stdout .splitlines ()
1034
+ self .assertEqual (len (lines ), 3 )
1035
+ for line in lines :
1032
1036
self .assertRegex (line , rb"cannot import name 'Fraction' from 'fractions' \(.*\)" )
1033
1037
1034
1038
# Various issues with origin
@@ -1051,7 +1055,9 @@ class substr(str):
1051
1055
1052
1056
popen = script_helper .spawn_python ("main.py" , cwd = tmp )
1053
1057
stdout , stderr = popen .communicate ()
1054
- for line in stdout .splitlines ():
1058
+ lines = stdout .splitlines ()
1059
+ self .assertEqual (len (lines ), 2 )
1060
+ for line in lines :
1055
1061
self .assertEqual (line , b"module 'fractions' has no attribute 'Fraction'" )
1056
1062
1057
1063
with open (os .path .join (tmp , "main.py" ), "w" , encoding = 'utf-8' ) as f :
@@ -1072,7 +1078,9 @@ class substr(str):
1072
1078
""" )
1073
1079
popen = script_helper .spawn_python ("main.py" , cwd = tmp )
1074
1080
stdout , stderr = popen .communicate ()
1075
- for line in stdout .splitlines ():
1081
+ lines = stdout .splitlines ()
1082
+ self .assertEqual (len (lines ), 2 )
1083
+ for line in lines :
1076
1084
self .assertRegex (line , rb"cannot import name 'Fraction' from 'fractions' \(.*\)" )
1077
1085
1078
1086
def test_script_shadowing_stdlib_sys_path_modification (self ):
0 commit comments