Skip to content

Commit 9fa62e7

Browse files
author
Filip Schouwenaars
authored
Merge pull request #154 from datacamp/fix-test-or
fix probe arg partialing for nested test_or
2 parents ad0a52a + ff9e53d commit 9fa62e7

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

pythonwhat/probe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ def __iter__(self):
113113

114114
def partial(self):
115115
"""Return partial of original function call"""
116-
return partial(self.data['func'], **self.data['bound_args'].arguments)
116+
ba = self.data['bound_args']
117+
return partial(self.data['func'], *ba.args, **ba.kwargs)
117118

118119
def update_child_calls(self):
119120
"""Replace child nodes on original function call with their partials"""

tests/test_test_or.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,17 @@ def test_Fail1_no_lam(self):
4848
self.data["DC_SCT"] = helper.remove_lambdas(self.data["DC_SCT"])
4949
self.test_Fail1()
5050

51+
class TestNestedOr(unittest.TestCase):
52+
def setUp(self):
53+
self.data = {
54+
"DC_SOLUTION": """for ii in range(10): print('yes') if ii < 2 else print('no')""",
55+
"DC_SCT": """test_for_loop(1, body=test_if_exp(body=test_or(test_student_typed('print'))))"""
56+
}
57+
58+
def test_pass(self):
59+
self.data["DC_CODE"] = self.data["DC_SOLUTION"]
60+
sct_payload = helper.run(self.data)
61+
self.assertTrue(sct_payload['correct'])
62+
5163
if __name__ == "__main__":
5264
unittest.main()

0 commit comments

Comments
 (0)