|
3 | 3 | from pythonwhat.Test import EqualTest, Test |
4 | 4 | from pythonwhat import utils |
5 | 5 | 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 |
7 | 7 | from pythonwhat.check_has_context import has_context |
8 | 8 |
|
9 | 9 | from functools import partial |
@@ -45,14 +45,12 @@ def test_with(index, |
45 | 45 | quiet_child = quiet(1, child) |
46 | 46 |
|
47 | 47 | 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 | | - |
54 | 48 | # test context var names ---- |
55 | 49 | 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 | + |
56 | 54 |
|
57 | 55 | # Context sub tests ---- |
58 | 56 | if context_tests and not isinstance(context_tests, list): context_tests = [context_tests] |
|
0 commit comments