Skip to content

Commit fe84acd

Browse files
Merge pull request #211 from m-messer/physical_quantitiy_<=_fix
Physical quantitiy <= fix
2 parents a9ac616 + f0e4260 commit fe84acd

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,5 @@ app/benchmark.py
135135
*.wpr
136136
*.wpu
137137
app/profiling_examples.py
138+
139+
.idea/

app/context/physical_quantity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def less_than_node(criterion, parameters, label=None):
208208

209209
def less_than_or_equal_node(criterion, parameters, label=None):
210210
# TODO: Add nodes for the equal case
211-
graph = comparison_base_graph(criterion, parameters, comparison_operator=">=", label=label)
211+
graph = comparison_base_graph(criterion, parameters, comparison_operator="<=", label=label)
212212
return graph
213213

214214

app/tests/__init__.py

Whitespace-only changes.

app/tests/physical_quantity_evaluation_tests.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,66 @@ def test_quantity_with_multiple_of_positive_value(self):
269269
result = evaluation_function(res, ans, params, include_test_data=True)
270270
assert result["is_correct"] is True
271271

272+
def test_quantity_response_less_than_answer(self):
273+
ans = "15 Hz"
274+
res = "10 Hz"
275+
params = {
276+
"strict_syntax": False,
277+
"physical_quantity": True,
278+
"elementary functions": True,
279+
"criteria": "response < answer"
280+
}
281+
result = evaluation_function(res, ans, params, include_test_data=True)
282+
assert result["is_correct"] is True
283+
284+
def test_quantity_response_greater_than_equal_answer(self):
285+
ans = "5 Hz"
286+
res = "10 Hz"
287+
params = {
288+
"strict_syntax": False,
289+
"physical_quantity": True,
290+
"elementary functions": True,
291+
"criteria": "response >= answer"
292+
}
293+
result = evaluation_function(res, ans, params, include_test_data=True)
294+
assert result["is_correct"] is True
295+
296+
def test_quantity_response_greater_than_equal_answer_equal(self):
297+
ans = "10 Hz"
298+
res = "10 Hz"
299+
params = {
300+
"strict_syntax": False,
301+
"physical_quantity": True,
302+
"elementary functions": True,
303+
"criteria": "response >= answer"
304+
}
305+
result = evaluation_function(res, ans, params, include_test_data=True)
306+
assert result["is_correct"] is True
307+
308+
def test_quantity_response_less_than_equal_answer(self):
309+
ans = "15 Hz"
310+
res = "10 Hz"
311+
params = {
312+
"strict_syntax": False,
313+
"physical_quantity": True,
314+
"elementary functions": True,
315+
"criteria": "response <= answer"
316+
}
317+
result = evaluation_function(res, ans, params, include_test_data=True)
318+
assert result["is_correct"] is True
319+
320+
def test_quantity_response_less_than_equal_answer_equal(self):
321+
ans = "10 Hz"
322+
res = "10 Hz"
323+
params = {
324+
"strict_syntax": False,
325+
"physical_quantity": True,
326+
"elementary functions": True,
327+
"criteria": "response <= answer"
328+
}
329+
result = evaluation_function(res, ans, params, include_test_data=True)
330+
assert result["is_correct"] is True
331+
272332
def test_radians_to_frequency(self):
273333
ans = "2*pi*f radian/second"
274334
res = "f Hz"

0 commit comments

Comments
 (0)