Skip to content

numpy 1.14.0 breaks some doctests #1496

Closed

Description

@peterjc

See e.g. https://travis-ci.org/biopython/biopython/jobs/326400449 from pull request #1495, which shows the following failures:

======================================================================
FAIL: Record (Bio.Affy.CelFile)
Doctest: Bio.Affy.CelFile.Record
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/2.7.14/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for Bio.Affy.CelFile.Record
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Affy/CelFile.py", line 38, in Record

----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Affy/CelFile.py", line 49, in Bio.Affy.CelFile.Record
Failed example:
    print(c.intensities)
Expected:
    [[   234.    170.  22177.    164.  22104.]
     [   188.    188.  21871.    168.  21883.]
     [   188.    193.  21455.    198.  21300.]
     [   188.    182.  21438.    188.  20945.]
     [   193.  20370.    174.  20605.    168.]]
Got:
    [[  234.   170. 22177.   164. 22104.]
     [  188.   188. 21871.   168. 21883.]
     [  188.   193. 21455.   198. 21300.]
     [  188.   182. 21438.   188. 20945.]
     [  193. 20370.   174. 20605.   168.]]
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Affy/CelFile.py", line 55, in Bio.Affy.CelFile.Record
Failed example:
    print(c.stdevs)
Expected:
    [[   24.     34.5  2669.     19.7  3661.2]
     [   29.8    29.8  2795.9    67.9  2792.4]
     [   29.8    88.7  2976.5    62.   2914.5]
     [   29.8    76.2  2759.5    49.2  2762. ]
     [   38.8  2611.8    26.6  2810.7    24.1]]
Got:
    [[  24.    34.5 2669.    19.7 3661.2]
     [  29.8   29.8 2795.9   67.9 2792.4]
     [  29.8   88.7 2976.5   62.  2914.5]
     [  29.8   76.2 2759.5   49.2 2762. ]
     [  38.8 2611.8   26.6 2810.7   24.1]]


======================================================================
FAIL: SVDSuperimposer (Bio.SVDSuperimposer)
Doctest: Bio.SVDSuperimposer.SVDSuperimposer
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/2.7.14/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for Bio.SVDSuperimposer.SVDSuperimposer
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/SVDSuperimposer/__init__.py", line 24, in SVDSuperimposer

----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/SVDSuperimposer/__init__.py", line 83, in Bio.SVDSuperimposer.SVDSuperimposer
Failed example:
    print(y_on_x1)
Expected:
    [[  5.17e+01  -1.90e+00   5.01e+01]
     [  5.04e+01  -1.23e+00   5.06e+01]
     [  5.07e+01  -4.16e-02   5.15e+01]
     [  5.02e+01  -1.94e-02   5.29e+01]]
Got:
    [[ 5.17e+01 -1.90e+00  5.01e+01]
     [ 5.04e+01 -1.23e+00  5.06e+01]
     [ 5.07e+01 -4.16e-02  5.15e+01]
     [ 5.02e+01 -1.94e-02  5.29e+01]]
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/SVDSuperimposer/__init__.py", line 88, in Bio.SVDSuperimposer.SVDSuperimposer
Failed example:
    print(y_on_x2)
Expected:
    [[  5.17e+01  -1.90e+00   5.01e+01]
     [  5.04e+01  -1.23e+00   5.06e+01]
     [  5.07e+01  -4.16e-02   5.15e+01]
     [  5.02e+01  -1.94e-02   5.29e+01]]
Got:
    [[ 5.17e+01 -1.90e+00  5.01e+01]
     [ 5.04e+01 -1.23e+00  5.06e+01]
     [ 5.07e+01 -4.16e-02  5.15e+01]
     [ 5.02e+01 -1.94e-02  5.29e+01]]


----------------------------------------------------------------------

Quoting the NumPy 1.14.0 release notes:

The str and repr of ndarrays and numpy scalars have been changed in
a variety of ways. These changes are likely to break downstream user's
doctests.

Specifically I think we're seeing this change:

The repr of float arrays often omits a space previously printed
in the sign position. See the new sign option to np.set_printoptions.

We might want to try calling numpy.set_printoptions(legacy="1.13") from run_tests.py to avoid this in the short term.

Activity

  1. peterjc commented on Jan 8, 2018

    @peterjc
    MemberAuthor

    Or, we could explicitly request numpy 1.13.x for TravisCI and AppVeyor?

  2. peterjc commented on Feb 23, 2018

    @peterjc
    MemberAuthor

    Closed by #1541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions