Skip to content

Commit 2232d4e

Browse files
author
Filip Schouwenaars
committed
Add failing test for #353
1 parent fc2bfb8 commit 2232d4e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_check_function.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,19 @@ def test_function_parser(code):
190190
p.visit(ast.parse(code))
191191
assert 'round' in p.out
192192

193+
def test_check_function_parser_mappings_1():
194+
code = "import numpy as np\nnp.random.randint(1, 7)"
195+
s = setup_state(code, code)
196+
s.check_function('numpy.random.randint')
197+
198+
# Because the mappings are only found for the substate that is zoomed in on,
199+
# The `import numpy as np` part is not found, because it's outside of the for loop.
200+
# This should be fixed!!!
201+
@pytest.mark.xfail
202+
def test_check_function_parser_mappings_2():
203+
code = "import numpy as np\nfor x in range(0): np.random.randint(1, 7)"
204+
s = setup_state(code, code)
205+
s.check_for_loop().check_body().check_function('numpy.random.randint')
193206

194207
# Incorrect usage -------------------------------------------------------------
195208

0 commit comments

Comments
 (0)