Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed failing test on python3. #2080

Merged
merged 1 commit into from

2 participants

@pelson
Collaborator

No description provided.

@pelson
Collaborator

fixes #2075.

@mdboom mdboom merged commit e2d674c into from
@mdboom
Owner

Sorry -- I should have waited for Travis before merging this. It seems there's a new problem behind this:

======================================================================
ERROR: matplotlib.tests.test_colors.test_cmap_and_norm_from_levels_and_colors2
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.2/lib/python3.2/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/travis/virtualenv/python3.2/lib/python3.2/site-packages/matplotlib-1.3.x-py3.2-linux-x86_64.egg/matplotlib/tests/test_colors.py", line 166, in test_cmap_and_norm_from_levels_and_colors2
    for d_val, expected_color in sorted(cases.items()):
TypeError: unorderable types: str() < int()

If you can't get to this, I'll try to find a solution.

@mdboom mdboom referenced this pull request from a commit
@mdboom mdboom Fix test on Python 3. Fixes #2080 f966e4a
@mdboom
Owner

Fixed by f966e4a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 29, 2013
  1. @pelson
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/matplotlib/tests/test_colors.py
View
11 lib/matplotlib/tests/test_colors.py
@@ -122,6 +122,7 @@ def test_cmap_and_norm_from_levels_and_colors2():
clr = mcolors.colorConverter.to_rgba_array(colors)
bad = (0.1, 0.1, 0.1, 0.1)
no_color = (0.0, 0.0, 0.0, 0.0)
+ masked_value = 'masked value'
# Define the test values which are of interest.
# Note: levels are lev[i] <= v < lev[i+1]
@@ -131,7 +132,7 @@ def test_cmap_and_norm_from_levels_and_colors2():
2.25: clr[2],
3: clr[4],
3.5: clr[4],
- np.ma.array(1, mask=True): bad}),
+ masked_value: bad}),
('min', -1, {-2: clr[0],
-1: clr[1],
@@ -139,7 +140,7 @@ def test_cmap_and_norm_from_levels_and_colors2():
2.25: clr[2],
3: no_color,
3.5: no_color,
- np.ma.array(1, mask=True): bad}),
+ masked_value: bad}),
('max', -1, {-2: no_color,
-1: clr[0],
@@ -147,7 +148,7 @@ def test_cmap_and_norm_from_levels_and_colors2():
2.25: clr[1],
3: clr[3],
3.5: clr[3],
- np.ma.array(1, mask=True): bad}),
+ masked_value: bad}),
('neither', -2, {-2: no_color,
-1: clr[0],
@@ -155,7 +156,7 @@ def test_cmap_and_norm_from_levels_and_colors2():
2.25: clr[1],
3: no_color,
3.5: no_color,
- np.ma.array(1, mask=True): bad}),
+ masked_value: bad}),
]
for extend, i1, cases in tests:
@@ -163,6 +164,8 @@ def test_cmap_and_norm_from_levels_and_colors2():
extend=extend)
cmap.set_bad(bad)
for d_val, expected_color in sorted(cases.items()):
+ if d_val == masked_value:
+ d_val = np.ma.array(1, mask=True)
assert_array_equal(expected_color, cmap(norm([d_val]))[0],
'Wih extend={0!r} and data '
'value={1!r}'.format(extend, d_val))
Something went wrong with that request. Please try again.