Skip to content

check_function inside for loop can't find aliases outside #353

@filipsch

Description

@filipsch

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!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions