Repository: PEtab-dev/libpetab-python

Issue:
Reduce tests to min+max python?
takes quite some time to start+run all ...

Discussion:
codecov-commenter: # [Codecov](https://codecov.io/gh/PEtab-dev/libpetab-python/pull/136?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev) Report
> Merging [#136](https://codecov.io/gh/PEtab-dev/libpetab-python/pull/136?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev) (f2a18b1) into [develop](https://codecov.io/gh/PEtab-dev/libpetab-python/commit/902f34967ecc60230339006dc21e233578075dc6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev) (902f349) will **decrease** coverage by `0.07%`.
> The diff coverage is `n/a`.

```diff
@@             Coverage Diff             @@
##           develop     #136      +/-   ##
===========================================
- Coverage    77.24%   77.16%   -0.08%     
===========================================
  Files           27       27              
  Lines         2957     2956       -1     
  Branches       723      717       -6     
===========================================
- Hits          2284     2281       -3     
- Misses         490      491       +1     
- Partials       183      184       +1     
```


| [Impacted Files](https://codecov.io/gh/PEtab-dev/libpetab-python/pull/136?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev) | Coverage Δ | |
|---|---|---|
| [petab/lint.py](https://codecov.io/gh/PEtab-dev/libpetab-python/pull/136/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev#diff-cGV0YWIvbGludC5weQ==) | `66.76% <0.00%> (-0.60%)` | :arrow_down: |
| [petab/visualize/plotting.py](https://codecov.io/gh/PEtab-dev/libpetab-python/pull/136/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev#diff-cGV0YWIvdmlzdWFsaXplL3Bsb3R0aW5nLnB5) | `85.76% <0.00%> (-0.05%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/PEtab-dev/libpetab-python/pull/136?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/PEtab-dev/libpetab-python/pull/136?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev). Last update [902f349...f2a18b1](https://codecov.io/gh/PEtab-dev/libpetab-python/pull/136?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PEtab-dev).


Patch:
diff --git a/petab/lint.py b/petab/lint.py
index ba9ad8f..e13f540 100644
--- a/petab/lint.py
+++ b/petab/lint.py
@@ -292,7 +292,12 @@ def check_observable_df(observable_df: pd.DataFrame) -> None:
 
         noise = getattr(row, NOISE_FORMULA)
         try:
-            sp.sympify(noise)
+            sympified_noise = sp.sympify(noise)
+            if sympified_noise is None \
+                    or (sympified_noise.is_Number
+                        and not sympified_noise.is_finite):
+                raise AssertionError(f"No or non-finite {NOISE_FORMULA} "
+                                     f"given for observable {row.Index}.")
         except sp.SympifyError as e:
             raise AssertionError(f"Cannot parse expression '{noise}' "
                                  f"for noise model for observable "


Test patch:
diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml
index 1c92a34..2aee552 100644
--- a/.github/workflows/ci_tests.yml
+++ b/.github/workflows/ci_tests.yml
@@ -11,7 +11,7 @@ jobs:
     strategy:
       matrix:
         platform: [windows-latest, macos-latest, ubuntu-latest]
-        python-version: [3.7, 3.8, 3.9, "3.10"]
+        python-version: ["3.7", "3.10"]
     runs-on: ${{ matrix.platform }}
 
     steps:
diff --git a/tests/test_lint.py b/tests/test_lint.py
index eccbed2..40f4c61 100644
--- a/tests/test_lint.py
+++ b/tests/test_lint.py
@@ -495,6 +495,12 @@ def test_check_observable_df():
     with pytest.raises(AssertionError):
         lint.check_observable_df(bad_observable_df)
 
+    # Check that missing noiseFormula is detected
+    bad_observable_df = observable_df.copy()
+    bad_observable_df.loc['obs1', NOISE_FORMULA] = nan
+    with pytest.raises(AssertionError):
+        lint.check_observable_df(bad_observable_df)
+
 
 def test_condition_ids_are_unique():
     condition_df = pd.DataFrame(data={