From df3c37603098f21bec64e2396e4fc9daa302e5f5 Mon Sep 17 00:00:00 2001 From: Valerij Talagayev <82884038+talagayev@users.noreply.github.com> Date: Sun, 27 Oct 2024 21:19:03 +0100 Subject: [PATCH 1/5] Update test_base.py Added pytest case where both frames and start/stop/step are present to raise valueerror --- testsuite/MDAnalysisTests/analysis/test_base.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/testsuite/MDAnalysisTests/analysis/test_base.py b/testsuite/MDAnalysisTests/analysis/test_base.py index 68b86fc943..de747e35fd 100644 --- a/testsuite/MDAnalysisTests/analysis/test_base.py +++ b/testsuite/MDAnalysisTests/analysis/test_base.py @@ -121,6 +121,14 @@ def test_incompatible_n_workers(u): with pytest.raises(ValueError): FrameAnalysis(u).run(backend=backend, n_workers=3) +def test_frame_values_incompatability(u): + start, stop, step = 0, 4, 1 + frames = [1, 2, 3, 4] + + with pytest.raises(ValueError, match="start/stop/step cannot be combined with frames"): + FrameAnalysis(u.trajectory).run(frames=frames, start=start, stop=stop, step=step) + + @pytest.mark.parametrize('run_class,backend,n_workers', [ (Parallelizable, 'not-existing-backend', 2), (Parallelizable, 'not-existing-backend', None), From 664ac4e204ec437b57408bd70877a8879fe0bbfe Mon Sep 17 00:00:00 2001 From: Valerij Talagayev <82884038+talagayev@users.noreply.github.com> Date: Sun, 27 Oct 2024 21:23:16 +0100 Subject: [PATCH 2/5] Update CHANGELOG Updated changelog to add coverage of raise error case where frames and start/stop/step are present --- package/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/package/CHANGELOG b/package/CHANGELOG index 892e47d385..fc4782566f 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -82,6 +82,7 @@ Enhancements (Issue #4673) * enables parallelization for analysis.dssp.dssp.DSSP (Issue #4674) * Enables parallelization for analysis.hydrogenbonds.hbond_analysis.HydrogenBondAnalysis (Issue #4664) + * Added pytest case to cover Raise errors cases frames and step/stop/step are present (Issue #4648) * Improve error message for `AtomGroup.unwrap()` when bonds are not present.(Issue #4436, PR #4642) * Add `analysis.DSSP` module for protein secondary structure assignment, based on [pydssp](https://github.com/ShintaroMinami/PyDSSP) * Added a tqdm progress bar for `MDAnalysis.analysis.pca.PCA.transform()` From 91eef3e4647ec0b0943068e1a64924162d83e4f0 Mon Sep 17 00:00:00 2001 From: Valerij Talagayev <82884038+talagayev@users.noreply.github.com> Date: Sun, 27 Oct 2024 21:43:27 +0100 Subject: [PATCH 3/5] Update test_base.py --- testsuite/MDAnalysisTests/analysis/test_base.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/testsuite/MDAnalysisTests/analysis/test_base.py b/testsuite/MDAnalysisTests/analysis/test_base.py index de747e35fd..ead6e84c75 100644 --- a/testsuite/MDAnalysisTests/analysis/test_base.py +++ b/testsuite/MDAnalysisTests/analysis/test_base.py @@ -121,13 +121,19 @@ def test_incompatible_n_workers(u): with pytest.raises(ValueError): FrameAnalysis(u).run(backend=backend, n_workers=3) + def test_frame_values_incompatability(u): start, stop, step = 0, 4, 1 frames = [1, 2, 3, 4] - with pytest.raises(ValueError, match="start/stop/step cannot be combined with frames"): - FrameAnalysis(u.trajectory).run(frames=frames, start=start, stop=stop, step=step) - + with pytest.raises(ValueError, + match="start/stop/step cannot be combined with frames"): + FrameAnalysis(u.trajectory).run( + frames=frames, + start=start, + stop=stop, + step=step + ) @pytest.mark.parametrize('run_class,backend,n_workers', [ (Parallelizable, 'not-existing-backend', 2), From 24a65d671d0e054fb170e6a70a918d43e0f4b598 Mon Sep 17 00:00:00 2001 From: Valerij Talagayev <82884038+talagayev@users.noreply.github.com> Date: Sun, 27 Oct 2024 21:44:11 +0100 Subject: [PATCH 4/5] Update test_base.py --- testsuite/MDAnalysisTests/analysis/test_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/MDAnalysisTests/analysis/test_base.py b/testsuite/MDAnalysisTests/analysis/test_base.py index ead6e84c75..c3d356a770 100644 --- a/testsuite/MDAnalysisTests/analysis/test_base.py +++ b/testsuite/MDAnalysisTests/analysis/test_base.py @@ -126,7 +126,7 @@ def test_frame_values_incompatability(u): start, stop, step = 0, 4, 1 frames = [1, 2, 3, 4] - with pytest.raises(ValueError, + with pytest.raises(ValueError, match="start/stop/step cannot be combined with frames"): FrameAnalysis(u.trajectory).run( frames=frames, From 29d4da927a9d30c0f0e4b714a4bf13e23e1dfc5c Mon Sep 17 00:00:00 2001 From: Valerij Talagayev <82884038+talagayev@users.noreply.github.com> Date: Mon, 28 Oct 2024 10:06:30 +0100 Subject: [PATCH 5/5] Update CHANGELOG removed Changelog change --- package/CHANGELOG | 1 - 1 file changed, 1 deletion(-) diff --git a/package/CHANGELOG b/package/CHANGELOG index fc4782566f..892e47d385 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -82,7 +82,6 @@ Enhancements (Issue #4673) * enables parallelization for analysis.dssp.dssp.DSSP (Issue #4674) * Enables parallelization for analysis.hydrogenbonds.hbond_analysis.HydrogenBondAnalysis (Issue #4664) - * Added pytest case to cover Raise errors cases frames and step/stop/step are present (Issue #4648) * Improve error message for `AtomGroup.unwrap()` when bonds are not present.(Issue #4436, PR #4642) * Add `analysis.DSSP` module for protein secondary structure assignment, based on [pydssp](https://github.com/ShintaroMinami/PyDSSP) * Added a tqdm progress bar for `MDAnalysis.analysis.pca.PCA.transform()`