From e032412ebd46a7582fa73e20b8cf3c805be2bb3d Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Fri, 27 Oct 2023 08:39:33 +0200 Subject: [PATCH 1/3] [ci] Added python 3.12 to pytest and examples workflows. (#212) --- .github/workflows/examples.yml | 2 +- .github/workflows/pytest.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index cd4f73c9..dd2fc4cf 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ["3.8", "3.10"] + python-version: ["3.8", "3.10", "3.12"] steps: - name: Checkout source diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b6a5290f..b76dba9f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] include: - os: macos-latest python-version: "3.10" From eb83ff20914c56fd3a07547d55982a0937450983 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Fri, 10 Nov 2023 14:21:35 +0100 Subject: [PATCH 2/3] [ci] removed failing pytest 3.12 test for now. --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b76dba9f..b6a5290f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11"] include: - os: macos-latest python-version: "3.10" From d689959b1f34a359f37f3cb6c39e1c6985e2135f Mon Sep 17 00:00:00 2001 From: s-kuberski Date: Fri, 10 Nov 2023 19:13:11 +0100 Subject: [PATCH 3/3] fix: Check if configs appears multiple times when creating an obs (#216) --- pyerrors/obs.py | 4 +++- tests/obs_test.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pyerrors/obs.py b/pyerrors/obs.py index df287a10..3f86a6b3 100644 --- a/pyerrors/obs.py +++ b/pyerrors/obs.py @@ -104,7 +104,9 @@ class Obs: elif isinstance(idx, (list, np.ndarray)): dc = np.unique(np.diff(idx)) if np.any(dc < 0): - raise ValueError("Unsorted idx for idl[%s]" % (name)) + raise ValueError("Unsorted idx for idl[%s] at position %s" % (name, ' '.join(['%s' % (pos + 1) for pos in np.where(np.diff(idx) < 0)[0]]))) + elif np.any(dc == 0): + raise ValueError("Duplicate entries in idx for idl[%s] at position %s" % (name, ' '.join(['%s' % (pos + 1) for pos in np.where(np.diff(idx) == 0)[0]]))) if len(dc) == 1: self.idl[name] = range(idx[0], idx[-1] + dc[0], dc[0]) else: diff --git a/tests/obs_test.py b/tests/obs_test.py index 02d539ef..0631effe 100644 --- a/tests/obs_test.py +++ b/tests/obs_test.py @@ -40,6 +40,10 @@ def test_Obs_exceptions(): pe.Obs([np.random.rand(4)], ['name']) with pytest.raises(ValueError): pe.Obs([np.random.rand(5)], ['1'], idl=[[5, 3, 2 ,4 ,1]]) + with pytest.raises(ValueError): + pe.Obs([np.random.rand(5)], ['1'], idl=[[1, 2, 3, 3, 5]]) + with pytest.raises(ValueError): + pe.Obs([np.random.rand(5)], ['1'], idl=[[1, 1, 3, 1, 5]]) with pytest.raises(TypeError): pe.Obs([np.random.rand(5)], ['1'], idl=['t']) with pytest.raises(ValueError):