From 52f6f5f038f522f54f9f133324f0112d466a9e9b Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 7 Nov 2023 20:46:31 +0000 Subject: [PATCH 1/2] 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..0e9c82f --- /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 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 From 15e09e69d4863456219eb7efeb9a3993a18d1d2f Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Wed, 8 Nov 2023 12:04:28 +0000 Subject: [PATCH 2/2] Update test data with even trickier pressure case --- tests/data/sample_p_tricky/input.tsv | 33 ++++++++++------------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/tests/data/sample_p_tricky/input.tsv b/tests/data/sample_p_tricky/input.tsv index 0e9c82f..a937724 100644 --- a/tests/data/sample_p_tricky/input.tsv +++ b/tests/data/sample_p_tricky/input.tsv @@ -1,21 +1,12 @@ -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 +#H Bostrom Pressure Test Data RbCuCo(CN)6 +0.28246 0.00404 10.79264 9.94964 10.01934 90.0 90.0 90.0 +0.54597 0.00682 10.72611 9.92916 10.01096 90.0 90.0 90.0 +0.82194 0.00772 10.66755 9.90688 10.00328 90.0 90.0 90.0 +1.12088 0.00917 10.60337 9.88151 9.992910 90.0 90.0 90.0 +1.42459 0.01061 10.53919 9.85840 9.983770 90.0 90.0 90.0 +1.80077 0.01318 10.46293 9.82224 9.970770 90.0 90.0 90.0 +2.24237 0.01797 10.37014 9.77598 9.954700 90.0 90.0 90.0 +2.82361 0.02499 10.25861 9.72716 9.938910 90.0 90.0 90.0 +3.5739 0.03621 10.15985 9.66307 9.913310 90.0 90.0 90.0 +4.24775 0.04907 10.07138 9.59475 9.884650 90.0 90.0 90.0 +4.81786 0.06139 10.00112 9.55436 9.851440 90.0 90.0 90.0