1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 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@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):
|