Skip to content

Commit 44c324c

Browse files
Merge pull request #72 from lambda-feedback/tr86-factorial-notation
Fixed so that ! is accepted when strict_syntax is false
2 parents a3c58ea + 8867246 commit 44c324c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

app/evaluation_tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,5 +883,15 @@ def test_replace_lambda(self):
883883
result = evaluation_function(response, answer, params)
884884
assert result["is_correct"] is True
885885

886+
def test_exclamation_mark_for_factorial(self):
887+
response = "3!"
888+
answer = "factorial(3)"
889+
params = {
890+
"strict_syntax": False,
891+
"elementary_functions": True,
892+
}
893+
result = evaluation_function(response, answer, params)
894+
assert result["is_correct"] is True
895+
886896
if __name__ == "__main__":
887897
pytest.main(['-xsk not slow', "--tb=line", os.path.abspath(__file__)])

app/expression_utilities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,9 @@ def parse_expression(expr, parsing_params):
579579
expr = substitute(expr, substitutions)
580580
can_split = lambda x: False if x in unsplittable_symbols else _token_splittable(x)
581581
if strict_syntax:
582-
transformations = parser_transformations[0:4]+extra_transformations
582+
transformations = parser_transformations[0:5]+extra_transformations
583583
else:
584-
transformations = parser_transformations[0:4, 6]+extra_transformations+(split_symbols_custom(can_split),)+parser_transformations[8]
584+
transformations = parser_transformations[0:5, 6]+extra_transformations+(split_symbols_custom(can_split),)+parser_transformations[8]
585585
if parsing_params.get("rationalise", False):
586586
transformations += parser_transformations[11]
587587
if parsing_params.get("simplify", False):

0 commit comments

Comments
 (0)