Skip to content

Commit fb1d3cc

Browse files
Added test for when input symbol has elementary function as a substring
1 parent 8147d53 commit fb1d3cc

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

app/tests/physical_quantity_evaluation_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def test_tolerance_given_as_string(self):
373373
result = evaluation_function(res, ans, params, include_test_data=True)
374374
assert result["is_correct"] is False
375375

376-
def test_compatibility(self):
376+
def test_answer_zero_value(self):
377377
ans = "0 m"
378378
res = "1 m"
379379
params = {

app/tests/symbolic_evaluation_tests.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,5 +1941,24 @@ def test_equality_expression_mismatch_with_custom_criteria(self):
19411941
result = evaluation_function(response, answer, params)
19421942
assert result["is_correct"] is False
19431943

1944+
def test_input_symbols_takes_priority_when_containing_elementary_function_names_as_substring(self):
1945+
response = "Vmax - Vmaxe^-(t/tau)"
1946+
answer = "Vmax*(1-exp(-t/tau))"
1947+
params = {
1948+
"atol": 0,
1949+
"rtol": 0,
1950+
"strict_syntax": False,
1951+
"elementary_functions": True,
1952+
"physical_quantity": False,
1953+
"symbols": {
1954+
"Vmax": {"aliases": ["V_max"], "latex": r"$V_{max}$"},
1955+
"RS": {"aliases": ["R_S", "rs"], "latex": r"$R_S$"},
1956+
"RF": {"aliases": ["R_F", "rf"], "latex": r"$R_f$"},
1957+
"tau": {"aliases": [], "latex": r"$\tau$"},
1958+
},
1959+
}
1960+
result = evaluation_function(response, answer, params)
1961+
assert result["is_correct"] is True
1962+
19441963
if __name__ == "__main__":
19451964
pytest.main(['-xk not slow', "--tb=line", '--durations=10', os.path.abspath(__file__)])

0 commit comments

Comments
 (0)