test_invalid_colormap: ValueError not raised #4215

Closed
yarikoptic opened this Issue Jul 11, 2013 · 10 comments

Comments

Projects
None yet
4 participants
Contributor

yarikoptic commented Jul 11, 2013

======================================================================
FAIL: test_invalid_colormap (pandas.tests.test_graphics.TestDataFrameGroupByPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/yoh/deb/gits/pkg-exppsy/build-area/pandas-0.11.0+git43-g7b2eaa4/debian/tmp/usr/lib/python2.7/dist-packages/pandas/tests/test_graphics.py", line 995, in test_invalid_colormap
    self.assertRaises(ValueError, df.plot, colormap='invalid_colormap')
AssertionError: ValueError not raised

that is under Agg backend and matplotlib 1.1.1~rc2-1

Contributor

jreback commented Jul 12, 2013

cc @qwhelan, @jtratner

anyone know why this is happening?

Contributor

jtratner commented Jul 12, 2013

@yarikoptic did you say you were using a customized back end?

Also, can you show us what happens if you try to get a non-standard colormap from your version of matplotlib?

This test, IIRC, just checks that plotting bubbles up the error from the mpl call to get the colormap. So if the other tests are passing, to me this suggests that either it's a matplotlib bug OR the Agg backend handles unknown colormaps differently.

If there is variance in how colormaps are handled by backend, we should add a skip test at the start if directly asking for a bad colormap doesn't raise an error.

Contributor

jtratner commented Jul 12, 2013

Should have been @yarikoptic above (sorry about that!)

Contributor

yarikoptic commented Jul 12, 2013

For me even with the default interactive backend I get no exception while asking for the colormap

$> python -c "import matplotlib as mpl; print mpl.__version__;import matplotlib.cm as cm; print cm.get_cmap('invalid_colormap');" 
1.1.1rc2
$> nosetests -s -v pandas/tests/test_graphics.py:TestDataFrameGroupByPlots.test_invalid_colormap
/usr/bin/nosetests:5: UserWarning: Module dap was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path
  from pkg_resources import load_entry_point
test_invalid_colormap (pandas.tests.test_graphics.TestDataFrameGroupByPlots) ... FAIL

======================================================================
FAIL: test_invalid_colormap (pandas.tests.test_graphics.TestDataFrameGroupByPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/yoh/deb/gits/pkg-exppsy/pandas/pandas/tests/test_graphics.py", line 995, in test_invalid_colormap
    self.assertRaises(ValueError, df.plot, colormap='invalid_colormap')
AssertionError: ValueError not raised

----------------------------------------------------------------------
Ran 1 test in 0.319s

FAILED (failures=1)
Member

cpcloud commented Jul 13, 2013

@yarikoptic I think t's because of the version of matplotlib that you're using

what you should see

In [7]: cm.get_cmap('invalid')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-ddb89b348247> in <module>()
----> 1 cm.get_cmap('invalid')

/home/phillip/.virtualenvs/pandas/lib/python2.7/site-packages/matplotlib/cm.pyc in get_cmap(name, lut)
    153             return _generate_cmap(name, lut)
    154
--> 155     raise ValueError("Colormap %s is not recognized" % name)
    156
    157 class ScalarMappable:

ValueError: Colormap invalid is not recognized

my versions

INSTALLED VERSIONS
------------------
Python: 2.7.5.final.0
OS: Linux 3.9.9-1-ARCH #1 SMP PREEMPT Wed Jul 3 22:45:16 CEST 2013 x86_64
LC_ALL: None
LANG: en_US.UTF-8

Cython: 0.19.1
Numpy: 1.7.1
Scipy: 0.12.0
statsmodels: 0.5.0.dev-95737a1
    patsy: 0.1.0
scikits.timeseries: 0.91.3
dateutil: 2.1
pytz: 2013b
bottleneck: 0.6.0
PyTables: 3.0.0
    numexpr: 2.1
matplotlib: 1.2.1
openpyxl: 1.6.2
xlrd: 0.9.2
xlwt: 0.7.5
sqlalchemy: 0.8.1
lxml: 3.2.1
bs4: 4.2.1
html5lib: 1.0b1
Member

cpcloud commented Jul 13, 2013

☎️ pandas version help hotline, how can i help you? 😄

Member

cpcloud commented Jul 13, 2013

yep it's the version, just installed 1.1.1 and it returns None

Member

cpcloud commented Jul 13, 2013

i'll add a version check in there in the test

Member

cpcloud commented Jul 13, 2013

actually u know what i'll raise if the color map is None

Member

cpcloud commented Jul 13, 2013

wow mpl gained a hefty 29MB from 1.1.1 to 1.2.1...

cpcloud was assigned Jul 13, 2013

cpcloud closed this in #4231 Jul 13, 2013

cpcloud was unassigned by wesm Oct 12, 2016

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