From d7ae9ae838e566519336a58a1c901dfa58facbd3 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Mon, 12 Jan 2026 17:11:00 +0100 Subject: [PATCH 1/2] replace deprecated assertRaisesRegexp with assertRaisesRegex --- tests/test_core.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 4273afc0..25f317f4 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -236,7 +236,7 @@ def test_one_dimensional(self): self.ord_res.proportion_explained = \ self.ord_res.proportion_explained[:1].copy() - with self.assertRaisesRegexp(ValueError, "Ordinations with less than " + with self.assertRaisesRegex(ValueError, "Ordinations with less than " "two dimensions are not supported"): Emperor(self.ord_res, self.mf, remote=False) @@ -244,7 +244,7 @@ def test_initial_unbalanced_more_than_five(self): mf = self.mf.copy() mf.drop(['PC.354', 'PC.355', 'PC.356', 'PC.481', 'PC.607', 'PC.636'], inplace=True) - with self.assertRaisesRegexp(KeyError, "There are samples not " + with self.assertRaisesRegex(KeyError, "There are samples not " "included in the sample mapping file. " "Override this error by using the " "`ignore_missing_samples` argument. " @@ -256,7 +256,7 @@ def test_initial_unbalanced_more_than_five(self): def test_initial_unbalanced(self): mf = self.mf.copy() mf.drop(['PC.354'], inplace=True) - with self.assertRaisesRegexp(KeyError, "There are samples not " + with self.assertRaisesRegex(KeyError, "There are samples not " "included in the sample mapping file. " "Override this error by using the " "`ignore_missing_samples` argument. " @@ -266,7 +266,7 @@ def test_initial_unbalanced(self): # test feature metadata fmf = self.feature_mf.copy() fmf.drop(['f.PC.636'], inplace=True) - with self.assertRaisesRegexp(KeyError, "There are features not " + with self.assertRaisesRegex(KeyError, "There are features not " "included in the feature mapping file. " "Override this error by using the " "`ignore_missing_samples` argument. " @@ -322,7 +322,7 @@ def test_no_overlap(self): mf = self.mf.copy() mf.index = mf.index + '.not' - with self.assertRaisesRegexp(ValueError, 'None of the sample ' + with self.assertRaisesRegex(ValueError, 'None of the sample ' 'identifiers match between the metadata ' 'and the coordinates. Verify that you are' ' using metadata and coordinates ' @@ -332,7 +332,7 @@ def test_no_overlap(self): fmf = self.feature_mf.copy() fmf.index = fmf.index + '.not' - with self.assertRaisesRegexp(ValueError, 'None of the feature ' + with self.assertRaisesRegex(ValueError, 'None of the feature ' 'identifiers match between the metadata ' 'and the coordinates. Verify that you are' ' using metadata and coordinates ' From 4b4eb1360de573bc7a29a7b235f4df3898bca9b1 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Mon, 12 Jan 2026 17:45:09 +0100 Subject: [PATCH 2/2] please flake8 --- tests/test_core.py | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 25f317f4..2e007509 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -237,7 +237,7 @@ def test_one_dimensional(self): self.ord_res.proportion_explained[:1].copy() with self.assertRaisesRegex(ValueError, "Ordinations with less than " - "two dimensions are not supported"): + "two dimensions are not supported"): Emperor(self.ord_res, self.mf, remote=False) def test_initial_unbalanced_more_than_five(self): @@ -245,32 +245,32 @@ def test_initial_unbalanced_more_than_five(self): mf.drop(['PC.354', 'PC.355', 'PC.356', 'PC.481', 'PC.607', 'PC.636'], inplace=True) with self.assertRaisesRegex(KeyError, "There are samples not " - "included in the sample mapping file. " - "Override this error by using the " - "`ignore_missing_samples` argument. " - "Showing only the first 5 samples out of " - "6: PC.354, PC.355, PC.356, PC.481, " - "PC.607 ..."): + "included in the sample mapping file. " + "Override this error by using the " + "`ignore_missing_samples` argument. " + "Showing only the first 5 samples out of " + "6: PC.354, PC.355, PC.356, PC.481, " + "PC.607 ..."): Emperor(self.ord_res, mf, remote=self.url) def test_initial_unbalanced(self): mf = self.mf.copy() mf.drop(['PC.354'], inplace=True) with self.assertRaisesRegex(KeyError, "There are samples not " - "included in the sample mapping file. " - "Override this error by using the " - "`ignore_missing_samples` argument. " - "Offending samples: PC.354"): + "included in the sample mapping file. " + "Override this error by using the " + "`ignore_missing_samples` argument. " + "Offending samples: PC.354"): Emperor(self.ord_res, mf, remote=self.url) # test feature metadata fmf = self.feature_mf.copy() fmf.drop(['f.PC.636'], inplace=True) with self.assertRaisesRegex(KeyError, "There are features not " - "included in the feature mapping file. " - "Override this error by using the " - "`ignore_missing_samples` argument. " - "Offending features: f.PC.636"): + "included in the feature mapping file. " + "Override this error by using the " + "`ignore_missing_samples` argument. " + "Offending features: f.PC.636"): Emperor(self.biplot, self.mf, fmf, remote=self.url) def test_initial_unbalanced_ignore(self): @@ -323,20 +323,20 @@ def test_no_overlap(self): mf.index = mf.index + '.not' with self.assertRaisesRegex(ValueError, 'None of the sample ' - 'identifiers match between the metadata ' - 'and the coordinates. Verify that you are' - ' using metadata and coordinates ' - 'corresponding to the same dataset.'): + 'identifiers match between the metadata ' + 'and the coordinates. Verify that you are' + ' using metadata and coordinates ' + 'corresponding to the same dataset.'): Emperor(self.ord_res, mf, remote=self.url) fmf = self.feature_mf.copy() fmf.index = fmf.index + '.not' with self.assertRaisesRegex(ValueError, 'None of the feature ' - 'identifiers match between the metadata ' - 'and the coordinates. Verify that you are' - ' using metadata and coordinates ' - 'corresponding to the same dataset.'): + 'identifiers match between the metadata ' + 'and the coordinates. Verify that you are' + ' using metadata and coordinates ' + 'corresponding to the same dataset.'): Emperor(self.biplot, self.mf, fmf, remote=self.url) def test_get_template(self):