Python: Avoid clobbering range in test

This was an unwanted interaction between two unrelated tests, so I
switched to a different built-in in the second test. I also added a test
case that shows an unfortunate side effect of this more restricted
handling of built-ins.
This commit is contained in:
Taus
2021-05-12 18:37:42 +00:00
committed by GitHub
parent ff2b6b9737
commit fe12e620dd

View File

@@ -122,14 +122,18 @@ def redefine_print():
print = my_print
print("these words")
def local_redefine_range():
range = 5
return range
def local_redefine_chr():
chr = 5
return chr
def global_redefine_range():
global range
range = 6
return range #$ SPURIOUS: use=moduleImport("builtins").getMember("range")
def global_redefine_chr():
global chr
chr = 6
return chr
def what_is_chr_now():
# If global_redefine_chr has been run, then the following is _not_ a reference to the built-in chr
return chr(123) #$ MISSING: use=moduleImport("builtins").getMember("chr").getReturn()
def obscured_print():
p = print #$ use=moduleImport("builtins").getMember("print")