Skip to content

Commit d712195

Browse files
More diagram experiments
1 parent 0d81365 commit d712195

File tree

4 files changed

+56
-48
lines changed

4 files changed

+56
-48
lines changed

app/tests/example_tests.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ def create_diagram_for_documentation(filename, result):
88
for (index, graph) in enumerate(result["criteria_graphs_vis"].values()):
99
with open(filename+"_"+str(index)+".md", "w") as f:
1010
#f.write(r'<!DOCTYPE html><html lang="en"><body><style>.mermaid {display: inline-flex;}</style>'+'\n')
11-
f.write("```mermaid")
11+
f.write("```mermaid\n")
1212
for g in result["criteria_graphs_vis"].values():
1313
print(g)
1414
#f.write('<pre class="mermaid">\n'+g+'\n</pre>\n')
15-
f.write(g)
15+
f.write(g+"\n")
1616
#f.write('<script type="module"> import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";</script></body></html>')
17-
f.write("```")
17+
f.write("```\n")
1818

1919
class TestEvaluationFunction():
2020
"""
@@ -163,7 +163,7 @@ def test_checking_the_value_of_a_physical_quantity_and_create_diagram_for_docs(s
163163
response = "2.00 kilometre/hour"
164164
answer = "2.00 km/h"
165165
result = evaluation_function(response, answer, params, include_test_data=True)
166-
create_diagram_for_documentation("physical_quantity.html", result)
166+
create_diagram_for_documentation("physical_quantity", result)
167167
assert result["is_correct"] == True
168168

169169
@pytest.mark.parametrize(
@@ -596,7 +596,7 @@ def test_custom_comparison_with_criteria_order(self, response, value, tags):
596596
}
597597
answer = "2*x^2"
598598
result = evaluation_function(response, answer, params, include_test_data=True)
599-
create_diagram_for_documentation("custom_comparison_with_criteria_order.html", result)
599+
create_diagram_for_documentation("custom_comparison_with_criteria_order", result)
600600
# with open("diagrams.html", "w") as f:
601601
# f.write(r'<!DOCTYPE html><html lang="en"><body><style>.mermaid {display: inline-flex;}</style>'+'\n')
602602
# for g in result["criteria_graphs_vis"].values():
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
```mermaidflowchart TD
2-
N_0_0(["2+answer > response<br/>---<br/>Checks if 2+answer > response is true."])
3-
N_1_0["2+answer > response_TRUE<br/>---<br/>2+answer > response is true."]
4-
N_1_1["2+answer > response_FALSE<br/>---<br/>2+answer > response is false."]
5-
N_1_2["2+answer > response_UNKNOWN<br/>---<br/>2+answer > response is false."]
6-
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
7-
N_0_0 --> N_1_0
8-
N_0_0 --> N_1_1
9-
N_1_2 --> N_2_0
10-
N_1_0 --> N_2_0
11-
N_0_0 --> N_1_2
12-
N_1_1 --> N_2_0flowchart TD
1+
```mermaid
2+
flowchart TD
133
N_0_0(["answer <= response<br/>---<br/>Checks if answer <= response is true."])
144
N_1_0["answer <= response_TRUE<br/>---<br/>answer <= response is true."]
155
N_1_1["answer <= response_FALSE<br/>---<br/>answer <= response is false."]
166
N_1_2["answer <= response_UNKNOWN<br/>---<br/>answer <= response is false."]
177
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
18-
N_0_0 --> N_1_0
198
N_0_0 --> N_1_1
9+
N_1_1 --> N_2_0
2010
N_1_2 --> N_2_0
11+
N_0_0 --> N_1_0
12+
N_0_0 --> N_1_2
2113
N_1_0 --> N_2_0
14+
flowchart TD
15+
N_0_0(["2+answer > response<br/>---<br/>Checks if 2+answer > response is true."])
16+
N_1_0["2+answer > response_TRUE<br/>---<br/>2+answer > response is true."]
17+
N_1_1["2+answer > response_FALSE<br/>---<br/>2+answer > response is false."]
18+
N_1_2["2+answer > response_UNKNOWN<br/>---<br/>2+answer > response is false."]
19+
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
20+
N_0_0 --> N_1_1
21+
N_1_1 --> N_2_0
22+
N_1_2 --> N_2_0
23+
N_0_0 --> N_1_0
2224
N_0_0 --> N_1_2
23-
N_1_1 --> N_2_0```
25+
N_1_0 --> N_2_0
26+
```
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
```mermaidflowchart TD
2-
N_0_0(["2+answer > response<br/>---<br/>Checks if 2+answer > response is true."])
3-
N_1_0["2+answer > response_TRUE<br/>---<br/>2+answer > response is true."]
4-
N_1_1["2+answer > response_FALSE<br/>---<br/>2+answer > response is false."]
5-
N_1_2["2+answer > response_UNKNOWN<br/>---<br/>2+answer > response is false."]
6-
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
7-
N_0_0 --> N_1_0
8-
N_0_0 --> N_1_1
9-
N_1_2 --> N_2_0
10-
N_1_0 --> N_2_0
11-
N_0_0 --> N_1_2
12-
N_1_1 --> N_2_0flowchart TD
1+
```mermaid
2+
flowchart TD
133
N_0_0(["answer <= response<br/>---<br/>Checks if answer <= response is true."])
144
N_1_0["answer <= response_TRUE<br/>---<br/>answer <= response is true."]
155
N_1_1["answer <= response_FALSE<br/>---<br/>answer <= response is false."]
166
N_1_2["answer <= response_UNKNOWN<br/>---<br/>answer <= response is false."]
177
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
18-
N_0_0 --> N_1_0
198
N_0_0 --> N_1_1
9+
N_1_1 --> N_2_0
2010
N_1_2 --> N_2_0
11+
N_0_0 --> N_1_0
12+
N_0_0 --> N_1_2
2113
N_1_0 --> N_2_0
14+
flowchart TD
15+
N_0_0(["2+answer > response<br/>---<br/>Checks if 2+answer > response is true."])
16+
N_1_0["2+answer > response_TRUE<br/>---<br/>2+answer > response is true."]
17+
N_1_1["2+answer > response_FALSE<br/>---<br/>2+answer > response is false."]
18+
N_1_2["2+answer > response_UNKNOWN<br/>---<br/>2+answer > response is false."]
19+
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
20+
N_0_0 --> N_1_1
21+
N_1_1 --> N_2_0
22+
N_1_2 --> N_2_0
23+
N_0_0 --> N_1_0
2224
N_0_0 --> N_1_2
23-
N_1_1 --> N_2_0```
25+
N_1_0 --> N_2_0
26+
```
Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
```mermaidflowchart TD
1+
```mermaid
2+
flowchart TD
23
N_0_0(["response matches answer<br/>---<br/>Converts QUANTITY: response tags: {} and QUANTITY: answer tags: {} match to a common set of base units and compares their values."])
34
N_0_1(["response matches answer_DIMENSION_MATCH<br/>---<br/>Do the dimensions of QUANTITY: response tags: {} and QUANTITY: answer tags: {} match?"])
45
N_0_2(["response matches answer_UNIT_COMPARISON<br/>---<br/>Compares how similar the units of QUANTITY: response tags: {} and QUANTITY: answer tags: {} are."])
@@ -15,25 +16,26 @@
1516
N_1_10["response matches answer_UNIT_COMPARISON_PREFIX_IS_LARGE<br/>---<br/>The units of QUANTITY: response tags: {} are at least 1000 times greater than the units of QUANTITY: answer tags: {}."]
1617
N_1_11["response matches answer_UNIT_COMPARISON_PREFIX_IS_SMALL<br/>---<br/>The units of QUANTITY: response tags: {} are at least 1000 times smaller than the units of QUANTITY: answer tags: {}."]
1718
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
19+
N_0_0 --> N_1_4
1820
N_0_0 --> N_1_1
19-
N_0_0 --> N_1_2
20-
N_1_3 --> N_2_0
21+
N_1_11 --> N_2_0
2122
N_1_2 --> N_2_0
22-
N_0_0 --> N_1_5
23-
N_0_0 --> N_1_4
24-
N_1_0 --> N_0_2
23+
N_1_7 --> N_2_0
24+
N_0_2 --> N_1_8
25+
N_0_0 --> N_1_2
26+
N_1_6 --> N_2_0
2527
N_0_1 --> N_1_7
28+
N_1_4 --> N_2_0
29+
N_0_2 --> N_1_10
30+
N_0_0 --> N_1_5
2631
N_1_5 --> N_2_0
27-
N_1_10 --> N_2_0
32+
N_1_3 --> N_2_0
2833
N_0_0 --> N_1_3
29-
N_0_2 --> N_1_8
30-
N_0_2 --> N_1_10
31-
N_1_7 --> N_2_0
32-
N_0_2 --> N_1_9
33-
N_0_2 --> N_1_11
34-
N_1_6 --> N_2_0
3534
N_0_0 --> N_1_0
35+
N_1_0 --> N_0_2
3636
N_1_1 --> N_0_1
37+
N_0_2 --> N_1_9
38+
N_1_10 --> N_2_0
3739
N_0_1 --> N_1_6
38-
N_1_4 --> N_2_0
39-
N_1_11 --> N_2_0```
40+
N_0_2 --> N_1_11
41+
```

0 commit comments

Comments
 (0)