11from pythonwhat .checks .check_logic import multi
22from pythonwhat .checks .has_funcs import has_part
3- from protowhat .Test import Test
43from protowhat .Feedback import InstructorError
5- from pythonwhat .Feedback import Feedback
64from pythonwhat .tasks import setUpNewEnvInProcess , breakDownNewEnvInProcess
75from pythonwhat .utils import get_ord
86from pythonwhat .utils_ast import assert_ast
@@ -14,12 +12,6 @@ def render(template, kwargs):
1412 return Template (template ).render (** kwargs )
1513
1614
17- class StubState :
18- def __init__ (self , highlight , highlighting_disabled ):
19- self .highlight = highlight
20- self .highlighting_disabled = highlighting_disabled
21-
22-
2315def part_to_child (stu_part , sol_part , append_message , state , node_name = None ):
2416 # stu_part and sol_part will be accessible on all templates
2517 append_message ["kwargs" ].update ({"stu_part" : stu_part , "sol_part" : sol_part })
@@ -139,7 +131,7 @@ def check_node(
139131 stu_out [index ]
140132 except (KeyError , IndexError ): # TODO comment errors
141133 _msg = state .build_message (missing_msg , fmt_kwargs )
142- state .report (Feedback ( _msg , state ) )
134+ state .report (_msg )
143135
144136 # get node at index
145137 stu_part = stu_out [index ]
@@ -167,20 +159,14 @@ def with_context(state, *args, child=None):
167159 process = state .student_process , context = state .student_parts ["with_items" ]
168160 )
169161 if isinstance (student_res , AttributeError ):
170- state .report (
171- Feedback (
172- "In your `with` statement, you're not using a correct context manager." ,
173- child .highlight , # TODO
174- )
162+ child .report (
163+ "In your `with` statement, you're not using a correct context manager."
175164 )
176165
177166 if isinstance (student_res , (AssertionError , ValueError , TypeError )):
178- state .report (
179- Feedback (
180- "In your `with` statement, the number of values in your context manager "
181- "doesn't correspond to the number of variables you're trying to assign it to." ,
182- child .highlight ,
183- )
167+ child .report (
168+ "In your `with` statement, the number of values in your context manager "
169+ "doesn't correspond to the number of variables you're trying to assign it to."
184170 )
185171
186172 # run subtests
@@ -200,11 +186,8 @@ def with_context(state, *args, child=None):
200186 close_student_context = breakDownNewEnvInProcess (process = state .student_process )
201187 if isinstance (close_student_context , Exception ):
202188 state .report (
203- Feedback (
204- "Your `with` statement can not be closed off correctly, you're "
205- + "not using the context manager correctly." ,
206- state ,
207- )
189+ "Your `with` statement can not be closed off correctly, you're "
190+ "not using the context manager correctly."
208191 )
209192 return state
210193
0 commit comments