|
9 | 9 | {%- set error_operation = inputs[-1]["operation"] -%}
|
10 | 10 | {% endif %}
|
11 | 11 | {%- if case["expected"] and inputs|length > 1 -%}
|
12 |
| - {%- set final = inputs[-1]["operation"] -%} |
13 | 12 | {%- set inputs = inputs[:-1] -%}
|
14 | 13 | {%- elif case["expected"] -%}
|
15 |
| - {%- set final = inputs[-1]["operation"] -%} |
16 |
| - {%- set inputs = [{"operation": "None"}] -%} |
| 14 | + {%- set inputs = [] -%} |
17 | 15 | {%- endif -%}
|
18 | 16 | {%- for input in inputs -%}
|
19 | 17 | {%- set operation = input["operation"] -%}
|
|
34 | 32 | {%- endif %}
|
35 | 33 | {%- endfor %}
|
36 | 34 | {%- if error_case %}
|
37 |
| - {%- if final == "pop" or final == "shift" %} |
| 35 | + {%- if error_operation == "pop" or error_operation == "shift" %} |
38 | 36 | with self.assertRaises(IndexError) as err:
|
39 | 37 | lst.{{ error_operation }}()
|
40 | 38 | self.assertEqual(type(err.exception), IndexError)
|
41 |
| - self.assertEqual(err.exception.args[0], "{{ error_msg }}") |
42 |
| - {% elif final == "delete" %} |
| 39 | + {%- elif error_operation == "delete" %} |
43 | 40 | with self.assertRaises(ValueError) as err:
|
44 |
| - lst.{{ final }}({{ value if value else 0 }}) |
| 41 | + lst.{{ error_operation }}({{ value if value else 0 }}) |
45 | 42 | self.assertEqual(type(err.exception), ValueError)
|
46 |
| - self.assertEqual(err.exception.args[0], "{{ error_msg }}") |
47 | 43 | {%- endif %}
|
| 44 | + self.assertEqual(err.exception.args[0], "{{ error_msg }}") |
48 | 45 | {%- endif %}
|
49 | 46 | {%- endmacro %}
|
50 | 47 |
|
|
0 commit comments