@@ -192,6 +192,26 @@ def test_e_latex(self, response, is_latex, is_correct):
192192
193193
194194
195+ @pytest .mark .parametrize ("params, is_correct" , [
196+ ({}, True ),
197+ ({"atol" : 0.0 , "rtol" : 0.0 , "strict_syntax" : False , "physical_quantity" : False , "elementary_functions" : False }, True ),
198+ ({"atol" : 0.0 , "rtol" : 0.0 , "strict_syntax" : False , "physical_quantity" : False , "elementary_functions" : True }, True ),
199+ ({"atol" : 0.0 , "rtol" : 0.0 , "strict_syntax" : True , "physical_quantity" : False , "elementary_functions" : False }, False ),
200+ ({"atol" : 0.0 , "rtol" : 0.0 , "strict_syntax" : True , "physical_quantity" : False , "elementary_functions" : True }, False ),
201+ ])
202+ def test_strict_syntax_rejects_implicit_multiplication (self , params , is_correct ):
203+ response = "-2M0/3"
204+ answer = "-2M0/3"
205+ if is_correct :
206+ result = evaluation_function (response , answer , params )
207+ assert result ["is_correct" ] is True
208+ else :
209+ # strict_syntax=True prevents implicit multiplication, so -2M0/3 cannot be
210+ # parsed. Answer parse failures are raised as exceptions (not returned as
211+ # is_correct=False) because they indicate a task misconfiguration.
212+ with pytest .raises (Exception ):
213+ evaluation_function (response , answer , params )
214+
195215 def test_mu_preview_evaluate (self ):
196216 response = "10 μA"
197217 params = Params (is_latex = False , elementary_functions = False , strict_syntax = False , physical_quantity = True )
0 commit comments