pythonwhat icon indicating copy to clipboard operation
pythonwhat copied to clipboard

check_function inside for loop can't find aliases outside

Open filipsch opened this issue 6 years ago • 0 comments

The following works fine:

# solution
import numpy as np
np.random.randint(1, 7)

# sct
Ex().check_function('numpy.random.randint')

The following does not:

# solution
import numpy as np
for x in range(0):
    np.random.randint(1, 7)

# sct
Ex().check_for_loop().check_body().check_function('numpy.random.randint')

This is because the mappings of aliases onto their modules are figured out on a per-state basis (instead of once, on the root).

There's a failing test (with the xfail mark) here.

This is a pretty big bug!!!

filipsch avatar Sep 14 '18 14:09 filipsch