Skip to content

Test errors with numpy 1.5 - advice? #3191

Description

@matthew-brett

I am getting test errors with current matplotlib trunk and numpy 1.5.1. An example is here:

======================================================================
ERROR: test suite for <class 'matplotlib.tests.test_axes.test_hist_stacked_bar'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/plugins/multiprocess.py", line 788, in run
    self.setUp()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/plugins/multiprocess.py", line 770, in setupContext
    super(NoSharedFixtureContextSuite, self).setupContext(context)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/util.py", line 470, in try_run
    return func()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 139, in setup_class
    cls._func()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/tests/test_axes.py", line 1988, in test_hist_stacked_bar
    ax.hist(d, bins=10, histtype='barstacked', align='mid', color=colors, label=labels)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 5479, in hist
    flat = np.ravel(x)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 1097, in ravel
    return asarray(a).ravel(order)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/numeric.py", line 284, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.

See: https://s3.amazonaws.com/archive.travis-ci.org/jobs/29198712/log.txt

This boils down to the following code:

In [5]: x = [[], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]

In [6]: np.array(x)

This raises an error (setting an array element with a sequence) for numpy 1.5.1 but passes for numpy 1.6.0. Should I try and work round this, or should matplotlib update compatibility to numpy 1.6.0 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions