Skip to content

Commit a1e1fc2

Browse files
committed
Merge pull request matplotlib#5739 from jenshnielsen/labelformatwarning
Silence labeled data warning in tests
2 parents 123807d + 05ea5ff commit a1e1fc2

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ def _plot_args_replacer(args, data):
6161
except ValueError:
6262
pass
6363
else:
64-
msg = "Second argument is ambiguous: could be a color spec " \
64+
msg = "Second argument '{}' is ambiguous: could be a color spec " \
6565
"but is in data. Using as data.\nEither rename the " \
66-
"entry in data or use three arguments to plot."
66+
"entry in data or use three arguments " \
67+
"to plot.".format(args[1])
6768
warnings.warn(msg, RuntimeWarning, stacklevel=3)
6869
return ["x", "y"]
6970
elif len(args) == 3:

lib/matplotlib/tests/test_cycles.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import warnings
22

33
from matplotlib.testing.decorators import image_comparison, cleanup
4+
from matplotlib.cbook import MatplotlibDeprecationWarning
45
import matplotlib.pyplot as plt
56
import numpy as np
67
from nose.tools import assert_raises
@@ -160,6 +161,7 @@ def test_cycle_reset():
160161
fig, ax = plt.subplots()
161162
# Need to double-check the old set/get_color_cycle(), too
162163
with warnings.catch_warnings():
164+
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
163165
prop = next(ax._get_lines.prop_cycler)
164166
ax.set_color_cycle(['c', 'm', 'y', 'k'])
165167
assert prop != next(ax._get_lines.prop_cycler)

lib/matplotlib/tests/test_labeled_data_unpacking.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,10 @@ def funcy(ax, *args, **kwargs):
395395
return "{args} | {kwargs}".format(args=args, kwargs=kwargs)
396396

397397
# the normal case...
398-
data = {"x": "X", "y1": "Y"}
399-
assert_equal(funcy(None, "x", "y1", data=data),
398+
data = {"x": "X", "hy1": "Y"}
399+
assert_equal(funcy(None, "x", "hy1", data=data),
400400
"('X', 'Y') | {}")
401-
assert_equal(funcy(None, "x", "y1", "c", data=data),
401+
assert_equal(funcy(None, "x", "hy1", "c", data=data),
402402
"('X', 'Y', 'c') | {}")
403403

404404
# no arbitrary long args with data

lib/matplotlib/tests/test_type1font.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def test_Type1Font():
1414
font = t1f.Type1Font(filename)
1515
slanted = font.transform({'slant': 1})
1616
condensed = font.transform({'extend': 0.5})
17-
rawdata = open(filename, 'rb').read()
17+
with open(filename, 'rb') as f:
18+
rawdata = f.read()
1819
assert_equal(font.parts[0], rawdata[0x0006:0x10c5])
1920
assert_equal(font.parts[1], rawdata[0x10cb:0x897f])
2021
assert_equal(font.parts[2], rawdata[0x8985:0x8ba6])

0 commit comments

Comments
 (0)