respec / HSPsquared

Hydrologic Simulation Program Python (HSPsquared)
GNU Affero General Public License v3.0
43 stars 17 forks source link

Test case for IWater and PWater subroutines #151

Closed austinorr closed 2 months ago

austinorr commented 2 months ago

Revisions include:

tests/ipwater/test_ipwater.py .. [100%]

============================================================ 2 passed in 0.45s ============================================================= Name Stmts Miss Branch BrPart Cover

HSP2/ADCALC.py 155 141 76 0 10% HSP2/ATEMP.py 27 19 4 0 32% HSP2/CONS.py 154 143 54 0 6% HSP2/COPY.py 18 10 2 0 40% HSP2/GENER.py 104 70 20 0 27% HSP2/GQUAL.py 1136 1116 454 0 2% HSP2/HTRCH.py 309 296 102 0 4% HSP2/HYDR.py 477 455 196 0 4% HSP2/IQUAL.py 182 173 58 0 5% HSP2/IWATER.py 199 52 72 14 70% HSP2/IWTGAS.py 116 104 36 0 9% HSP2/NUTRX_Class.py 592 564 222 0 5% HSP2/OXRX_Class.py 141 127 32 0 9% HSP2/PHCARB_Class.py 130 117 32 0 9% HSP2/PLANK_Class.py 960 914 334 1 5% HSP2/PQUAL.py 264 252 74 0 4% HSP2/PSTEMP.py 145 136 58 0 5% HSP2/PWATER.py 534 154 168 34 68% HSP2/PWTGAS.py 269 256 92 0 4% HSP2/RQUAL.py 349 330 182 0 4% HSP2/RQUAL_Class.py 719 698 168 1 3% HSP2/RQUTIL.py 24 17 12 0 36% HSP2/SEDMNT.py 152 143 52 0 5% HSP2/SEDTRN.py 725 708 192 0 3% HSP2/SNOW.py 446 433 156 0 3% HSP2/SOLIDS.py 92 84 36 0 8% HSP2/SPECL.py 4 1 2 0 83% HSP2/init.py 4 0 0 0 100% HSP2/configuration.py 41 13 0 0 68% HSP2/main.py 291 277 144 0 3% HSP2/mainDoE.py 194 175 90 0 7% HSP2/state.py 117 90 26 0 20% HSP2/uci.py 14 10 0 0 29% HSP2/utilities.py 318 256 224 5 14% HSP2IO/io.py 48 34 10 0 24% HSP2IO/protocols.py 32 6 10 0 86% _version.py 1 0 0 0 100% tests/init.py 0 0 0 0 100% tests/ipwater/init.py 0 0 0 0 100% tests/ipwater/test_ipwater.py 46 0 16 0 100%

TOTAL 9529 8374 3406 55 11%


This shows the ~70% coverage for HSP2/IWater and HSP2/PWater modules.

We can also run the suite with the numba jit to ensure we didn't break anything.
```bash
(hsp2) aorr@POR-AORR:~/wsl-sources/HSPsquared$ coverage run --branch -m  pytest tests/ipwater  && coverage report
=========================================================== test session starts ============================================================
platform linux -- Python 3.11.5, pytest-7.4.3, pluggy-1.3.0
rootdir: /home/aorr/wsl-sources/HSPsquared
collected 2 items                                                                                                                          

tests/ipwater/test_ipwater.py ..                                                                                                     [100%]

============================================================ 2 passed in 4.52s =============================================================
Name                            Stmts   Miss Branch BrPart  Cover
-----------------------------------------------------------------
HSP2/ADCALC.py                    155    141     76      0    10%
HSP2/ATEMP.py                      27     19      4      0    32%
HSP2/CONS.py                      154    143     54      0     6%
HSP2/COPY.py                       18     10      2      0    40%
HSP2/GENER.py                     104     70     20      0    27%
HSP2/GQUAL.py                    1136   1116    454      0     2%
HSP2/HTRCH.py                     309    296    102      0     4%
HSP2/HYDR.py                      477    455    196      0     4%
HSP2/IQUAL.py                     182    173     58      0     5%
HSP2/IWATER.py                    199    166     72      3    17%
HSP2/IWTGAS.py                    116    104     36      0     9%
HSP2/NUTRX_Class.py               592    564    222      0     5%
HSP2/OXRX_Class.py                141    127     32      0     9%
HSP2/PHCARB_Class.py              130    117     32      0     9%
HSP2/PLANK_Class.py               960    914    334      1     5%
HSP2/PQUAL.py                     264    252     74      0     4%
HSP2/PSTEMP.py                    145    136     58      0     5%
HSP2/PWATER.py                    534    489    168      3     9%
HSP2/PWTGAS.py                    269    256     92      0     4%
HSP2/RQUAL.py                     349    330    182      0     4%
HSP2/RQUAL_Class.py               719    698    168      1     3%
HSP2/RQUTIL.py                     24     17     12      0    36%
HSP2/SEDMNT.py                    152    143     52      0     5%
HSP2/SEDTRN.py                    725    708    192      0     3%
HSP2/SNOW.py                      446    433    156      0     3%
HSP2/SOLIDS.py                     92     84     36      0     8%
HSP2/SPECL.py                       4      1      2      0    83%
HSP2/__init__.py                    4      0      0      0   100%
HSP2/configuration.py              41     13      0      0    68%
HSP2/main.py                      291    277    144      0     3%
HSP2/mainDoE.py                   194    175     90      0     7%
HSP2/state.py                     117     90     26      0    20%
HSP2/uci.py                        14     10      0      0    29%
HSP2/utilities.py                 318    256    224      5    14%
HSP2IO/io.py                       48     34     10      0    24%
HSP2IO/protocols.py                32      6     10      0    86%
_version.py                         1      0      0      0   100%
tests/__init__.py                   0      0      0      0   100%
tests/ipwater/__init__.py           0      0      0      0   100%
tests/ipwater/test_ipwater.py      46      0     16      0   100%
-----------------------------------------------------------------
TOTAL                            9529   8823   3406     13     7%

Here we see the tests pass, but line coverage can't be measured since it's all been compiled.

austinorr commented 2 months ago

Request review from @PaulDudaRESPEC and @rburghol

austinorr commented 2 months ago

@PaulDudaRESPEC yep, that sounds fine. Is that the long-term branch management pattern that this project intends to use, or is this just temporary while we manage the current push of changes?

austinorr commented 2 months ago

@PaulDudaRESPEC ok, rebased revisions on the develop branch.