Skip to content

Commit 25ebe56

Browse files
committed
test_with cleaned up to use has_equal_part_len
1 parent 37081d2 commit 25ebe56

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

pythonwhat/test_funcs/test_with.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pythonwhat.Test import EqualTest, Test
44
from pythonwhat import utils
55
from pythonwhat.tasks import setUpNewEnvInProcess, breakDownNewEnvInProcess
6-
from pythonwhat.check_funcs import check_node, check_part, check_part_index, multi, quiet, has_equal_part, with_context
6+
from pythonwhat.check_funcs import check_node, check_part, check_part_index, multi, quiet, has_equal_part, with_context, has_equal_part_len
77
from pythonwhat.check_has_context import has_context
88

99
from functools import partial
@@ -45,14 +45,12 @@ def test_with(index,
4545
quiet_child = quiet(1, child)
4646

4747
if context_vals:
48-
# test num context vars ----
49-
too_many = len(child.student_parts['context']) > len(child.solution_parts['context'])
50-
if too_many:
51-
_msg = child.build_message(MSG_NUM_CTXT)
52-
rep.do_test(Test(Feedback(_msg, child.student_tree)))
53-
5448
# test context var names ----
5549
has_context(incorrect_msg=context_vals_msg or MSG_CTXT_NAMES, exact_names = True, state=child)
50+
51+
# test num context vars ----
52+
has_equal_part_len('context', MSG_NUM_CTXT, state=child)
53+
5654

5755
# Context sub tests ----
5856
if context_tests and not isinstance(context_tests, list): context_tests = [context_tests]

0 commit comments

Comments
 (0)