[med-svn] [Git][med-team/python-skbio][master] 4 commits: Fix tests in skbio/diversity/tests/test_driver.py
Andreas Tille (@tille)
gitlab at salsa.debian.org
Mon Jan 30 16:41:46 GMT 2023
Andreas Tille pushed to branch master at Debian Med / python-skbio
Commits:
83a76c16 by Andreas Tille at 2023-01-30T13:36:13+01:00
Fix tests in skbio/diversity/tests/test_driver.py
- - - - -
390784d2 by Andreas Tille at 2023-01-30T16:34:28+01:00
This attempt seems to be a failure. Lots of tests keep on failing due to np.int32 - np.int64 discrepancies
--> Rather exclude architectures with broken tests
- - - - -
e59e2f11 by Andreas Tille at 2023-01-30T16:40:21+01:00
Exclude 32bit architectures be explicitly setting architectures where package is building properly
- - - - -
738721ff by Andreas Tille at 2023-01-30T17:38:35+01:00
Upload to unstable
- - - - -
4 changed files:
- debian/changelog
- debian/control
- debian/patches/numpy-1.24.patch
- + debian/patches/numpy-1.24_32bit.patch
Changes:
=====================================
debian/changelog
=====================================
@@ -1,8 +1,9 @@
-python-skbio (0.5.8-2exp2) UNRELEASED; urgency=medium
+python-skbio (0.5.8-3) unstable; urgency=medium
- * Try fixing some issue for 32bit architectures
+ * Exclude 32bit architectures be explicitly setting architectures where
+ package is building properly
- -- Andreas Tille <tille at debian.org> Sun, 29 Jan 2023 11:25:28 +0100
+ -- Andreas Tille <tille at debian.org> Mon, 30 Jan 2023 17:29:50 +0100
python-skbio (0.5.8-2exp1) experimental; urgency=medium
=====================================
debian/control
=====================================
@@ -54,7 +54,7 @@ Description: Data structures, algorithms, educational resources for bioinformati
Build-Profiles: <!nodoc>
Package: python3-skbio
-Architecture: any
+Architecture: amd64 arm64 mips64el ppc64el riscv64
Depends: ${shlibs:Depends},
${misc:Depends},
${python3:Depends},
=====================================
debian/patches/numpy-1.24.patch
=====================================
@@ -6,7 +6,7 @@ Forwarded: https://github.com/biocore/scikit-bio/issues/1839
--- a/skbio/alignment/_indexing.py
+++ b/skbio/alignment/_indexing.py
-@@ -113,7 +113,10 @@ class _Indexing(metaclass=ABCMeta):
+@@ -113,7 +113,10 @@
if isinstance(indexable, np.ndarray):
pass
elif hasattr(indexable, '__iter__'):
@@ -20,7 +20,7 @@ Forwarded: https://github.com/biocore/scikit-bio/issues/1839
--- a/skbio/sequence/tests/test_sequence.py
+++ b/skbio/sequence/tests/test_sequence.py
-@@ -459,7 +459,7 @@ class TestSequence(TestSequenceBase, Rea
+@@ -459,7 +459,7 @@
Sequence(np.array([1, "23", 3]))
with self.assertRaises(TypeError):
# object
@@ -29,16 +29,7 @@ Forwarded: https://github.com/biocore/scikit-bio/issues/1839
# invalid input type (non-numpy.ndarray input)
with self.assertRaisesRegex(TypeError, r'tuple'):
-@@ -885,7 +885,7 @@ class TestSequence(TestSequenceBase, Rea
- metadata={'id': 'id9', 'description': 'dsc9'},
- positional_metadata={'quality': [0, 1, 2, 3, 15, 14,
- 13, 9]})
-- self.assertEqual(seq[np.array([0, 1, 2, 3, 15, 14, 13, 9])], eseq)
-+ self.assertEqual(seq[np.array([0, 1, 2, 3, 15, 14, 13, 9], dtype=np.int32)], eseq)
-
- def test_getitem_with_numpy_index_no_positional_metadata(self):
- s = "0123456789abcdef"
-@@ -2212,7 +2212,7 @@ class TestSequence(TestSequenceBase, Rea
+@@ -2212,7 +2212,7 @@
yield i
else:
yield np.array([i], dtype=int)
@@ -47,83 +38,3 @@ Forwarded: https://github.com/biocore/scikit-bio/issues/1839
lambda x: pd.Series(tuple(x))):
exp = np.arange(10, dtype=int)
obs = s._munge_to_index_array(c(mixed()))
---- a/skbio/io/format/fasta.py
-+++ b/skbio/io/format/fasta.py
-@@ -880,7 +880,7 @@ def _parse_quality_scores(chunks):
-
- qual_str = ' '.join(chunks)
- try:
-- quality = np.asarray(qual_str.split(), dtype=int)
-+ quality = np.asarray(qual_str.split(), dtype=np.int64)
- except ValueError:
- raise QUALFormatError(
- "Could not convert quality scores to integers:\n%s"
---- a/skbio/metadata/_testing.py
-+++ b/skbio/metadata/_testing.py
-@@ -457,7 +457,7 @@ class PositionalMetadataMixinTests:
-
- def test_eq_from_different_source(self):
- obj1 = self._positional_metadata_constructor_(
-- 3, positional_metadata={'foo': np.array([1, 2, 3])})
-+ 3, positional_metadata={'foo': np.array([1, 2, 3], dtype=np.int64)})
- obj2 = self._positional_metadata_constructor_(
- 3, positional_metadata=pd.DataFrame({'foo': [1, 2, 3]},
- index=['foo', 'bar', 'baz']))
---- a/skbio/alignment/tests/test_tabular_msa.py
-+++ b/skbio/alignment/tests/test_tabular_msa.py
-@@ -1661,7 +1661,7 @@ class TestILoc(SharedPropertyIndexTests,
- TabularMSA([a[0:0], b[0:0], c[0:0]],
- metadata={3: 3},
- positional_metadata={3: np.array(
-- [], dtype=int)}))
-+ [], dtype=np.int64)}))
-
- def test_fancy_empty_both_axes(self):
- a = DNA("ACGT", metadata={0: 0}, positional_metadata={0: [1, 2, 3, 4]})
---- a/skbio/stats/_subsample.py
-+++ b/skbio/stats/_subsample.py
-@@ -226,7 +226,7 @@ def subsample_counts(counts, n, replace=
- raise ValueError("n cannot be negative.")
-
- counts = np.asarray(counts)
-- counts = counts.astype(int, casting='safe')
-+ counts = counts.astype(np.int64, casting='safe')
-
- if counts.ndim != 1:
- raise ValueError("Only 1-D vectors are supported.")
---- a/skbio/diversity/tests/test_driver.py
-+++ b/skbio/diversity/tests/test_driver.py
-@@ -157,7 +157,7 @@ class AlphaDiversityTests(TestCase):
-
- def test_empty(self):
- # empty vector
-- actual = alpha_diversity('observed_otus', np.array([], dtype=np.int64))
-+ actual = alpha_diversity('observed_otus', np.array([], dtype=np.int32))
- expected = pd.Series([0])
- assert_series_almost_equal(actual, expected)
-
-@@ -194,11 +194,11 @@ class AlphaDiversityTests(TestCase):
- assert_series_almost_equal(actual, expected)
-
- def test_single_count_vector(self):
-- actual = alpha_diversity('observed_otus', np.array([1, 0, 2]))
-+ actual = alpha_diversity('observed_otus', np.array([1, 0, 2], np.int32))
- expected = pd.Series([2])
- assert_series_almost_equal(actual, expected)
-
-- actual = alpha_diversity('faith_pd', np.array([1, 3, 0, 1, 0]),
-+ actual = alpha_diversity('faith_pd', np.array([1, 3, 0, 1, 0], np.int32),
- tree=self.tree1, otu_ids=self.oids1)
- self.assertAlmostEqual(actual[0], 4.5)
-
-@@ -252,6 +252,10 @@ class AlphaDiversityTests(TestCase):
- def test_no_ids(self):
- # expected values hand-calculated
- expected = pd.Series([3, 3, 3, 3])
-+ # All this does not help
-+ # expected = pd.Series(np.array([3, 3, 3, 3], int32))
-+ # actual = np.int64(alpha_diversity('observed_otus', self.table1))
-+ # actual = np.dtype('int64').type(alpha_diversity('observed_otus', self.table1))
- actual = alpha_diversity('observed_otus', self.table1)
- assert_series_almost_equal(actual, expected)
-
=====================================
debian/patches/numpy-1.24_32bit.patch
=====================================
@@ -0,0 +1,99 @@
+Description: Adapt to numpy 1.24 also for 32bit architectures
+FIXME: This attempt seems to be a failure. Lots of tests keep on failing
+ due to np.int32 - np.int64 discrepancies
+ --> Rather exclude architectures with broken tests
+Bug-Debian: https://bugs.debian.org/1029452
+Author: Andreas Tille <tille at debian.org>
+Last-Update: 2023-01-29 20:55:34 +0530
+Forwarded: https://github.com/biocore/scikit-bio/issues/1840
+
+
+ --- a/skbio/sequence/tests/test_sequence.py
+ +++ b/skbio/sequence/tests/test_sequence.py
+-@@ -2212,7 +2212,7 @@
++@@ -885,7 +885,7 @@ class TestSequence(TestSequenceBase, Rea
++ metadata={'id': 'id9', 'description': 'dsc9'},
++ positional_metadata={'quality': [0, 1, 2, 3, 15, 14,
++ 13, 9]})
++- self.assertEqual(seq[np.array([0, 1, 2, 3, 15, 14, 13, 9])], eseq)
+++ self.assertEqual(seq[np.array([0, 1, 2, 3, 15, 14, 13, 9], dtype=np.int32)], eseq)
++
++ def test_getitem_with_numpy_index_no_positional_metadata(self):
++ s = "0123456789abcdef"
++@@ -2212,7 +2212,7 @@ class TestSequence(TestSequenceBase, Rea
+ yield i
+ else:
+ yield np.array([i], dtype=int)
+@@ -38,3 +47,72 @@
+ lambda x: pd.Series(tuple(x))):
+ exp = np.arange(10, dtype=int)
+ obs = s._munge_to_index_array(c(mixed()))
++--- a/skbio/io/format/fasta.py
+++++ b/skbio/io/format/fasta.py
++@@ -880,7 +880,7 @@ def _parse_quality_scores(chunks):
++
++ qual_str = ' '.join(chunks)
++ try:
++- quality = np.asarray(qual_str.split(), dtype=int)
+++ quality = np.asarray(qual_str.split(), dtype=np.int64)
++ except ValueError:
++ raise QUALFormatError(
++ "Could not convert quality scores to integers:\n%s"
++--- a/skbio/metadata/_testing.py
+++++ b/skbio/metadata/_testing.py
++@@ -457,7 +457,7 @@ class PositionalMetadataMixinTests:
++
++ def test_eq_from_different_source(self):
++ obj1 = self._positional_metadata_constructor_(
++- 3, positional_metadata={'foo': np.array([1, 2, 3])})
+++ 3, positional_metadata={'foo': np.array([1, 2, 3], dtype=np.int64)})
++ obj2 = self._positional_metadata_constructor_(
++ 3, positional_metadata=pd.DataFrame({'foo': [1, 2, 3]},
++ index=['foo', 'bar', 'baz']))
++--- a/skbio/alignment/tests/test_tabular_msa.py
+++++ b/skbio/alignment/tests/test_tabular_msa.py
++@@ -1661,7 +1661,7 @@ class TestILoc(SharedPropertyIndexTests,
++ TabularMSA([a[0:0], b[0:0], c[0:0]],
++ metadata={3: 3},
++ positional_metadata={3: np.array(
++- [], dtype=int)}))
+++ [], dtype=np.int64)}))
++
++ def test_fancy_empty_both_axes(self):
++ a = DNA("ACGT", metadata={0: 0}, positional_metadata={0: [1, 2, 3, 4]})
++--- a/skbio/stats/_subsample.py
+++++ b/skbio/stats/_subsample.py
++@@ -226,7 +226,7 @@ def subsample_counts(counts, n, replace=
++ raise ValueError("n cannot be negative.")
++
++ counts = np.asarray(counts)
++- counts = counts.astype(int, casting='safe')
+++ counts = counts.astype(np.int64, casting='safe')
++
++ if counts.ndim != 1:
++ raise ValueError("Only 1-D vectors are supported.")
++--- a/skbio/diversity/tests/test_driver.py
+++++ b/skbio/diversity/tests/test_driver.py
++@@ -194,11 +194,11 @@ class AlphaDiversityTests(TestCase):
++ assert_series_almost_equal(actual, expected)
++
++ def test_single_count_vector(self):
++- actual = alpha_diversity('observed_otus', np.array([1, 0, 2]))
+++ actual = alpha_diversity('observed_otus', np.array([1, 0, 2], np.int32))
++ expected = pd.Series([2])
++ assert_series_almost_equal(actual, expected)
++
++- actual = alpha_diversity('faith_pd', np.array([1, 3, 0, 1, 0]),
+++ actual = alpha_diversity('faith_pd', np.array([1, 3, 0, 1, 0], np.int32),
++ tree=self.tree1, otu_ids=self.oids1)
++ self.assertAlmostEqual(actual[0], 4.5)
++
++@@ -252,7 +252,7 @@ class AlphaDiversityTests(TestCase):
++ def test_no_ids(self):
++ # expected values hand-calculated
++ expected = pd.Series([3, 3, 3, 3])
++- actual = alpha_diversity('observed_otus', self.table1)
+++ actual = alpha_diversity('observed_otus', self.table1).astype(np.int64)
++ assert_series_almost_equal(actual, expected)
++
++ def test_optimized(self):
View it on GitLab: https://salsa.debian.org/med-team/python-skbio/-/compare/ab3e3d2cd2247f85503db43b49301d80472fa186...738721ff08175fff1bff7d9779a7c7432aded48e
--
View it on GitLab: https://salsa.debian.org/med-team/python-skbio/-/compare/ab3e3d2cd2247f85503db43b49301d80472fa186...738721ff08175fff1bff7d9779a7c7432aded48e
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20230130/a6364c4a/attachment-0001.htm>
More information about the debian-med-commit
mailing list