From 5267c10ea0c26b376304f2137393f81665fa3905 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 7 Nov 2023 20:46:31 +0000 Subject: [PATCH] Add a test for an awkward pressure fitting case --- tests/conftest.py | 5 +++++ tests/data/sample_p_tricky/input.tsv | 21 +++++++++++++++++++++ tests/test_app.py | 27 +++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 tests/data/sample_p_tricky/input.tsv diff --git a/tests/conftest.py b/tests/conftest.py index e4f7f34..51becee 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -25,6 +25,11 @@ def sample_p(): return load_sample_inputs("sample_p/input.tsv") +@fixture +def sample_p_tricky(): + return load_sample_inputs("sample_p_tricky/input.tsv") + + @fixture def sample_q(): return load_sample_inputs("sample_q/input.tsv") diff --git a/tests/data/sample_p_tricky/input.tsv b/tests/data/sample_p_tricky/input.tsv new file mode 100644 index 0000000..75d262b --- /dev/null +++ b/tests/data/sample_p_tricky/input.tsv @@ -0,0 +1,21 @@ +0.001 0.001 10.497 3.6309 6.1772 90.00 106.97 90.00 +0.196 0.001 10.495 3.6297 6.1740 90.00 106.98 90.00 +0.398 0.001 10.496 3.6279 6.1684 90.00 106.96 90.00 +0.598 0.001 10.495 3.6271 6.1648 90.00 106.95 90.00 +0.796 0.001 10.494 3.6260 6.1593 90.00 106.95 90.00 +0.993 0.001 10.492 3.6252 6.1557 90.00 106.97 90.00 +1.199 0.001 10.490 3.6240 6.1515 90.00 106.98 90.00 +1.399 0.001 10.488 3.6227 6.1476 90.00 106.97 90.00 +1.593 0.001 10.487 3.6217 6.1441 90.00 106.99 90.00 +1.794 0.001 10.486 3.6210 6.1409 90.00 107.01 90.00 +1.996 0.001 10.487 3.6197 6.1362 90.00 107.01 90.00 +2.196 0.001 10.487 3.6187 6.1323 90.00 107.01 90.00 +2.397 0.001 10.486 3.6177 6.1285 90.00 107.01 90.00 +2.597 0.001 10.485 3.6174 6.1248 90.00 107.02 90.00 +2.798 0.001 10.484 3.6164 6.1213 90.00 107.02 90.00 +2.997 0.001 10.483 3.6153 6.1180 90.00 107.03 90.00 +3.198 0.001 10.482 3.6141 6.1143 90.00 107.02 90.00 +3.397 0.001 10.481 3.6130 6.1105 90.00 107.02 90.00 +3.598 0.001 10.481 3.6120 6.1071 90.00 107.03 90.00 +3.798 0.001 10.480 3.6114 6.1032 90.00 107.05 90.00 +3.998 0.001 10.480 3.6106 6.0994 90.00 107.06 90.00 \ No newline at end of file diff --git a/tests/test_app.py b/tests/test_app.py index 6d6963c..280bae7 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -234,6 +234,33 @@ def test_p_no_pc_sample_data( assert len(tables) == 7 +def test_p_tricky_sample_data( + client, + sample_p_tricky, + parser, +): + post_parameters = { + "DataType": "Pressure", + "EulerianStrain": "True", + "FiniteStrain": "True", + "DegPolyCap": "", + "DegPolyVol": "", + "UsePc": "False", + "PcVal": "", + "data": sample_p_tricky, + } + + response = client.post("/output", data=post_parameters) + assert response.status_code == 200 + + html_response = [d for d in response.response] + assert len(html_response) == 1 + + soup = parser(html_response[0]) + tables = soup.find_all("table") + assert len(tables) == 7 + + def test_parse_options(): from PASCal.options import Options, PASCalDataType