Commit e29c6cdb authored by Andreas Tille's avatar Andreas Tille
Browse files

Fix suite fails with latest matplotlib

parent 6e4a81fc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,8 +7,9 @@ python-cogent (1.9-12) UNRELEASED; urgency=medium
  * debhelper 11
  * Point Vcs fields to salsa.debian.org
  * Standards-Version: 4.1.4
  * Fix suite fails with latest matplotlib

 -- Andreas Tille <tille@debian.org>  Wed, 28 Mar 2018 19:03:41 +0200
 -- Andreas Tille <tille@debian.org>  Tue, 05 Jun 2018 21:47:29 +0200

python-cogent (1.9-11) unstable; urgency=medium

+26 −0
Original line number Diff line number Diff line
Description: Ensure doctests pass with different numpy versions
 The numpy output format changed with numpy 1.14 and this causes doctests to
 fail if raw numerical output is compared. See
 https://wiki.debian.org/ContinuousIntegration/TriagingTips/numpy-1.14-doctests
Author: Stuart Prescott <stuart@debian.org>
Last-Update: Tue, 05 Jun 2018 15:32:46 +0000 (UTC)
Origin: https://github.com/pycogent/pycogent/files/2072985/numpy-doctests.patch
Bug-Debian: https://bugs.debian.org/899205

--- a/tests/alltests.py
+++ b/tests/alltests.py
@@ -6,6 +6,14 @@
 import doctest, cogent.util.unit_test as unittest, sys, os
 from cogent.util.misc import app_path
 
+# Whitespace changes between numpy 1.13 and 1.14 will cause the doctests
+# to fail; when doctests are updated to 1.14 format, this can be removed.
+try:    # CRUFT
+    import numpy as np
+    np.set_printoptions(legacy='1.13')
+except TypeError:
+    pass
+
 __author__ = "Peter Maxwell and Gavin Huttley"
 __copyright__ = "Copyright 2007-2016, The Cogent Project"
 __credits__ = ["Peter Maxwell", "Gavin Huttley", "Rob Knight",
+33 −0
Original line number Diff line number Diff line
Description: Use xor rather than subtraction on booleans
 Numpy no longer accepts the ambiguous construction of a-b when a and b are bools.
 Normally, this can be replaced with XORs.
Author: Stuart Prescott <stuart@debian.org>
Last-Update: Tue, 05 Jun 2018 15:32:46 +0000 (UTC)
Origin: https://github.com/pycogent/pycogent/files/2072984/numpy_xor.patch
Bug-Debian: https://bugs.debian.org/899205

--- a/cogent/core/sequence.py
+++ b/cogent/core/sequence.py
@@ -1248,7 +1248,7 @@
         gap_indices = map(self.Alphabet.index, self.MolType.Gaps)
         valid_indices = self._data < len(self.Alphabet)
         for i in gap_indices:
-            valid_indices -= self._data == i
+            valid_indices ^= self._data == i
         result = compress(valid_indices, self._data)
         return self.__class__(result, Info=self.Info)
 
--- a/cogent/maths/distance_transform.py
+++ b/cogent/maths/distance_transform.py
@@ -670,9 +670,9 @@
         return zeros((0,0),'d')
     dists = zeros((numrows,numrows),'d')
     for i in range(numrows):
-        r1 = datamtx[i] # cache here
+        r1 = datamtx[i].astype(dists.dtype) # cache here
         for j in range(i):
-            dists[i,j] = dists[j,i] = sum(abs(r1 - datamtx[j]))
+            dists[i,j] = dists[j,i] = sum(abs(r1 - datamtx[j].astype(dists.dtype)))
             
     return dists
 
+2 −0
Original line number Diff line number Diff line
@@ -9,3 +9,5 @@ skip_weak_tests.patch
adapt_to_ncbi-data_201609.patch
ignore_numpy_test_issue.patch
usr_bin_ls.patch
numpy_xor.patch
numpy-doctests.patch