diff --git a/appveyor.yml b/appveyor.yml
index 7d00b1c51f89..bed7d44a0df6 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -140,8 +140,8 @@ test_script:
- if x%USE_PYTEST% == xno python tests.py %PYTEST_ARGS%
# Generate a html for visual tests
- python visual_tests.py
- - if x%USE_PYTEST% == xyes pip install codecov
- - if x%USE_PYTEST% == xyes codecov -e PYTHON_VERSION PLATFORM
+ - pip install codecov
+ - codecov -e PYTHON_VERSION PLATFORM
after_test:
# After the tests were a success, build packages (wheels and conda)
diff --git a/ci/codecov.yml b/ci/codecov.yml
index 500b4a9f0d63..842794a555c6 100644
--- a/ci/codecov.yml
+++ b/ci/codecov.yml
@@ -24,5 +24,5 @@ coverage:
paths: '!lib/.*/tests/.*'
tests:
- target: 97.7%
+ target: 97.9%
paths: 'lib/.*/tests/.*'
diff --git a/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.pdf b/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.pdf
index 6404ae457352..2dd02c48fb5a 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.pdf and b/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.png b/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.png
index 86d29d3c4cd8..0884343cd928 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.png and b/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.svg b/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.svg
index b8f5be69bf98..6ce04555e1b3 100644
--- a/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.svg
+++ b/lib/matplotlib/tests/baseline_images/test_contour/contour_manual_labels.svg
@@ -27,17 +27,17 @@ z
" style="fill:#ffffff;"/>
-
-
-
-
-
-
-
-
+" id="m368fc901b1" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="mc63e59a608" style="stroke:#000000;stroke-width:0.5;"/>
-
+
@@ -159,7 +159,7 @@ Q 6.59375 54.828125 13.0625 64.515625
Q 19.53125 74.21875 31.78125 74.21875
" id="DejaVuSans-30"/>
-
+
@@ -167,12 +167,12 @@ Q 19.53125 74.21875 31.78125 74.21875
-
+
-
+
@@ -192,7 +192,7 @@ L 12.40625 0
z
" id="DejaVuSans-31"/>
-
+
@@ -200,12 +200,12 @@ z
-
+
-
+
@@ -235,7 +235,7 @@ Q 44.1875 33.984375 37.640625 27.21875
Q 31.109375 20.453125 19.1875 8.296875
" id="DejaVuSans-32"/>
-
+
@@ -243,12 +243,12 @@ Q 31.109375 20.453125 19.1875 8.296875
-
+
-
+
@@ -286,7 +286,7 @@ Q 53.90625 49.265625 50.4375 45.09375
Q 46.96875 40.921875 40.578125 39.3125
" id="DejaVuSans-33"/>
-
+
@@ -294,12 +294,12 @@ Q 46.96875 40.921875 40.578125 39.3125
-
+
-
+
@@ -323,7 +323,7 @@ L 4.890625 26.703125
z
" id="DejaVuSans-34"/>
-
+
@@ -331,12 +331,12 @@ z
-
+
-
+
@@ -367,7 +367,7 @@ Q 14.890625 38.140625 10.796875 36.28125
z
" id="DejaVuSans-35"/>
-
+
@@ -375,12 +375,12 @@ z
-
+
-
+
@@ -415,7 +415,7 @@ Q 40.921875 74.21875 44.703125 73.484375
Q 48.484375 72.75 52.59375 71.296875
" id="DejaVuSans-36"/>
-
+
@@ -423,12 +423,12 @@ Q 48.484375 72.75 52.59375 71.296875
-
+
-
+
@@ -444,7 +444,7 @@ L 8.203125 64.59375
z
" id="DejaVuSans-37"/>
-
+
@@ -452,12 +452,12 @@ z
-
+
-
+
@@ -500,7 +500,7 @@ Q 25.390625 66.40625 21.84375 63.234375
Q 18.3125 60.0625 18.3125 54.390625
" id="DejaVuSans-38"/>
-
+
@@ -508,12 +508,12 @@ Q 18.3125 60.0625 18.3125 54.390625
-
+
-
+
@@ -548,7 +548,7 @@ Q 16.21875 41.5 20.09375 36.953125
Q 23.96875 32.421875 30.609375 32.421875
" id="DejaVuSans-39"/>
-
+
@@ -560,25 +560,25 @@ Q 23.96875 32.421875 30.609375 32.421875
+" id="m556f96d829" style="stroke:#000000;stroke-width:0.5;"/>
-
+
+" id="m27e32ca04a" style="stroke:#000000;stroke-width:0.5;"/>
-
+
-
+
@@ -586,17 +586,17 @@ L -4 0
-
+
-
+
-
+
@@ -604,17 +604,17 @@ L -4 0
-
+
-
+
-
+
@@ -622,17 +622,17 @@ L -4 0
-
+
-
+
-
+
@@ -640,17 +640,17 @@ L -4 0
-
+
-
+
-
+
@@ -658,17 +658,17 @@ L -4 0
-
+
-
+
-
+
@@ -676,17 +676,17 @@ L -4 0
-
+
-
+
-
+
@@ -694,17 +694,17 @@ L -4 0
-
+
-
+
-
+
@@ -712,17 +712,17 @@ L -4 0
-
+
-
+
-
+
@@ -730,24 +730,24 @@ L -4 0
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
-
-
+
+
+
@@ -793,8 +793,8 @@ z
-
-
+
+
diff --git a/lib/matplotlib/tests/test_animation.py b/lib/matplotlib/tests/test_animation.py
index 7e8c2ea235df..61ad1e56ee49 100644
--- a/lib/matplotlib/tests/test_animation.py
+++ b/lib/matplotlib/tests/test_animation.py
@@ -162,6 +162,8 @@ def animate(i):
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=iter(range(5)))
+ writer = NullMovieWriter()
+ anim.save('unused.null', writer=writer)
def test_movie_writer_registry():
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
index 19cc9267b794..5dcb34981145 100644
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -27,7 +27,6 @@
import matplotlib.colors as mcolors
from numpy.testing import assert_allclose, assert_array_equal
from matplotlib.cbook import IgnoredKeywordWarning
-import matplotlib.colors as mcolors
# Note: Some test cases are run twice: once normally and once with labeled data
# These two must be defined in the same test function or need to have
@@ -110,7 +109,8 @@ def test_twin_axis_locaters_formatters():
ax1.yaxis.set_major_locator(majl)
ax1.yaxis.set_minor_locator(minl)
ax1.yaxis.set_major_formatter(plt.FormatStrFormatter('%08.2lf'))
- ax1.yaxis.set_minor_formatter(plt.FixedFormatter(['tricks', 'mind', 'jedi']))
+ ax1.yaxis.set_minor_formatter(plt.FixedFormatter(['tricks', 'mind',
+ 'jedi']))
ax1.xaxis.set_major_locator(plt.LinearLocator())
ax1.xaxis.set_minor_locator(plt.FixedLocator([15, 35, 55, 75]))
@@ -178,7 +178,8 @@ def test_twin_inherit_autoscale_setting():
assert not ax_y_off.get_autoscaley_on()
-@image_comparison(baseline_images=["minorticks_on_rcParams_both"], extensions=['png'])
+@image_comparison(baseline_images=["minorticks_on_rcParams_both"],
+ extensions=['png'])
def test_minorticks_on_rcParams_both():
fig = plt.figure()
matplotlib.rcParams['xtick.minor.visible'] = True
@@ -244,6 +245,7 @@ def test_use_sticky_edges():
assert_allclose(ax.get_xlim(), (-0.5, 1.5))
assert_allclose(ax.get_ylim(), (-0.5, 1.5))
+
@image_comparison(baseline_images=['offset_points'],
remove_text=True)
def test_basic_annotate():
@@ -358,20 +360,21 @@ def test_fill_units():
# Top-Right
ax2 = fig.add_subplot(222)
ax2.plot([t], [value], yunits='deg', color='red')
- ax2.fill([t, t, t+day, t+day],
- [0.0, 0.0, 90.0, 0.0], 'b')
+ ax2.fill([t, t, t + day, t + day],
+ [0.0, 0.0, 90.0, 0.0], 'b')
# Bottom-Left
ax3 = fig.add_subplot(223)
ax3.plot([t], [value], yunits='deg', color='red')
ax3.fill([733525.0, 733525.0, 733526.0, 733526.0],
- [0*units.deg, 0*units.deg, 90*units.deg, 0*units.deg], 'b')
+ [0 * units.deg, 0 * units.deg, 90 * units.deg, 0 * units.deg],
+ 'b')
# Bottom-Right
ax4 = fig.add_subplot(224)
ax4.plot([t], [value], yunits='deg', color='red')
- ax4.fill([t, t, t+day, t+day],
- [0*units.deg, 0*units.deg, 90*units.deg, 0*units.deg],
+ ax4.fill([t, t, t + day, t + day],
+ [0 * units.deg, 0 * units.deg, 90 * units.deg, 0 * units.deg],
facecolor="blue")
fig.autofmt_xdate()
@@ -391,14 +394,14 @@ def test_single_point():
plt.plot([1], [1], 'o')
# Reuse testcase from above for a labeled data test
- data = {'a':[0], 'b':[1]}
+ data = {'a': [0], 'b': [1]}
fig = plt.figure()
plt.subplot(211)
plt.plot('a', 'a', 'o', data=data)
plt.subplot(212)
- plt.plot('b','b', 'o', data=data)
+ plt.plot('b', 'b', 'o', data=data)
@image_comparison(baseline_images=['single_date'])
@@ -416,26 +419,36 @@ def test_single_date():
@image_comparison(baseline_images=['shaped_data'])
def test_shaped_data():
- xdata = np.array([[0.53295185, 0.23052951, 0.19057629, 0.66724975, 0.96577916,
- 0.73136095, 0.60823287, 0.01792100, 0.29744742, 0.27164665],
- [0.27980120, 0.25814229, 0.02818193, 0.12966456, 0.57446277,
- 0.58167607, 0.71028245, 0.69112737, 0.89923072, 0.99072476],
- [0.81218578, 0.80464528, 0.76071809, 0.85616314, 0.12757994,
- 0.94324936, 0.73078663, 0.09658102, 0.60703967, 0.77664978],
- [0.28332265, 0.81479711, 0.86985333, 0.43797066, 0.32540082,
- 0.43819229, 0.92230363, 0.49414252, 0.68168256, 0.05922372],
- [0.10721335, 0.93904142, 0.79163075, 0.73232848, 0.90283839,
- 0.68408046, 0.25502302, 0.95976614, 0.59214115, 0.13663711],
- [0.28087456, 0.33127607, 0.15530412, 0.76558121, 0.83389773,
- 0.03735974, 0.98717738, 0.71432229, 0.54881366, 0.86893953],
- [0.77995937, 0.99555600, 0.29688434, 0.15646162, 0.05184800,
- 0.37161935, 0.12998491, 0.09377296, 0.36882507, 0.36583435],
- [0.37851836, 0.05315792, 0.63144617, 0.25003433, 0.69586032,
- 0.11393988, 0.92362096, 0.88045438, 0.93530252, 0.68275072],
- [0.86486596, 0.83236675, 0.82960664, 0.57796630, 0.25724233,
- 0.84841095, 0.90862812, 0.64414887, 0.35652720, 0.71026066],
- [0.01383268, 0.34060930, 0.76084285, 0.70800694, 0.87634056,
- 0.08213693, 0.54655021, 0.98123181, 0.44080053, 0.86815815]])
+ xdata = np.array([[0.53295185, 0.23052951, 0.19057629, 0.66724975,
+ 0.96577916, 0.73136095, 0.60823287, 0.01792100,
+ 0.29744742, 0.27164665],
+ [0.27980120, 0.25814229, 0.02818193, 0.12966456,
+ 0.57446277, 0.58167607, 0.71028245, 0.69112737,
+ 0.89923072, 0.99072476],
+ [0.81218578, 0.80464528, 0.76071809, 0.85616314,
+ 0.12757994, 0.94324936, 0.73078663, 0.09658102,
+ 0.60703967, 0.77664978],
+ [0.28332265, 0.81479711, 0.86985333, 0.43797066,
+ 0.32540082, 0.43819229, 0.92230363, 0.49414252,
+ 0.68168256, 0.05922372],
+ [0.10721335, 0.93904142, 0.79163075, 0.73232848,
+ 0.90283839, 0.68408046, 0.25502302, 0.95976614,
+ 0.59214115, 0.13663711],
+ [0.28087456, 0.33127607, 0.15530412, 0.76558121,
+ 0.83389773, 0.03735974, 0.98717738, 0.71432229,
+ 0.54881366, 0.86893953],
+ [0.77995937, 0.99555600, 0.29688434, 0.15646162,
+ 0.05184800, 0.37161935, 0.12998491, 0.09377296,
+ 0.36882507, 0.36583435],
+ [0.37851836, 0.05315792, 0.63144617, 0.25003433,
+ 0.69586032, 0.11393988, 0.92362096, 0.88045438,
+ 0.93530252, 0.68275072],
+ [0.86486596, 0.83236675, 0.82960664, 0.57796630,
+ 0.25724233, 0.84841095, 0.90862812, 0.64414887,
+ 0.35652720, 0.71026066],
+ [0.01383268, 0.34060930, 0.76084285, 0.70800694,
+ 0.87634056, 0.08213693, 0.54655021, 0.98123181,
+ 0.44080053, 0.86815815]])
y1 = np.arange(10).reshape((1, -1))
y2 = np.arange(10).reshape((-1, 1))
@@ -518,7 +531,8 @@ def test_polar_units():
# make sure runits and theta units work
y1 = [y*km for y in y1]
plt.polar(x2, y1, color="blue", thetaunits="rad", runits="km")
- assert isinstance(plt.gca().get_xaxis().get_major_formatter(), units.UnitDblFormatter)
+ assert isinstance(plt.gca().get_xaxis().get_major_formatter(),
+ units.UnitDblFormatter)
@image_comparison(baseline_images=['polar_rmin'])
@@ -613,12 +627,13 @@ def test_hexbin_extent():
@image_comparison(baseline_images=['hexbin_empty'], remove_text=True,
- extensions=['png'])
+ extensions=['png'])
def test_hexbin_empty():
# From #3886: creating hexbin from empty dataset raises ValueError
ax = plt.gca()
ax.hexbin([], [])
+
def test_hexbin_pickable():
# From #1973: Test that picking a hexbin collection works
class FauxMouseEvent:
@@ -678,7 +693,8 @@ def test_inverted_limits():
@image_comparison(baseline_images=['nonfinite_limits'])
def test_nonfinite_limits():
x = np.arange(0., np.e, 0.01)
- olderr = np.seterr(divide='ignore') # silence divide by zero warning from log(0)
+ # silence divide by zero warning from log(0)
+ olderr = np.seterr(divide='ignore')
try:
y = np.log(x)
finally:
@@ -706,7 +722,7 @@ def test_imshow():
ax.imshow(r)
# Reuse testcase from above for a labeled data test
- data={"r": r}
+ data = {"r": r}
fig = plt.figure()
ax = fig.add_subplot(111)
ax.imshow("r", data=data)
@@ -801,8 +817,10 @@ def test_fill_between_interpolate():
fig = plt.figure()
ax = fig.add_subplot(211)
ax.plot(x, y1, x, y2, color='black')
- ax.fill_between(x, y1, y2, where=y2 >= y1, facecolor='white', hatch='/', interpolate=True)
- ax.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True)
+ ax.fill_between(x, y1, y2, where=y2 >= y1, facecolor='white', hatch='/',
+ interpolate=True)
+ ax.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red',
+ interpolate=True)
# Test support for masked arrays.
y2 = np.ma.masked_greater(y2, 1.0)
@@ -810,8 +828,10 @@ def test_fill_between_interpolate():
y2[0] = np.ma.masked
ax1 = fig.add_subplot(212, sharex=ax)
ax1.plot(x, y1, x, y2, color='black')
- ax1.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True)
- ax1.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True)
+ ax1.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green',
+ interpolate=True)
+ ax1.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red',
+ interpolate=True)
@image_comparison(baseline_images=['symlog'])
@@ -866,7 +886,7 @@ def test_symlog2():
ax.set_ylim(-0.1, 0.1)
-def test_pcolorargs():
+def test_pcolorargs_5205():
# Smoketest to catch issue found in gh:5205
x = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5]
y = [-1.5, -1.25, -1.0, -0.75, -0.5, -0.25, 0,
@@ -1006,7 +1026,8 @@ def test_arc_ellipse():
fig = plt.figure()
ax = fig.add_subplot(211, aspect='auto')
- ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1)
+ ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow',
+ linewidth=1, zorder=1)
e1 = patches.Arc((xcenter, ycenter), width, height,
angle=angle, linewidth=2, fill=False, zorder=2)
@@ -1221,19 +1242,21 @@ def test_hist_log():
@image_comparison(baseline_images=['hist_bar_empty'], remove_text=True,
- extensions=['png'])
+ extensions=['png'])
def test_hist_bar_empty():
# From #3886: creating hist from empty dataset raises ValueError
ax = plt.gca()
ax.hist([], histtype='bar')
+
@image_comparison(baseline_images=['hist_step_empty'], remove_text=True,
- extensions=['png'])
+ extensions=['png'])
def test_hist_step_empty():
# From #3886: creating hist from empty dataset raises ValueError
ax = plt.gca()
ax.hist([], histtype='step')
+
@image_comparison(baseline_images=['hist_steplog'], remove_text=True, tol=0.1)
def test_hist_steplog():
np.random.seed(0)
@@ -1253,7 +1276,8 @@ def test_hist_steplog():
plt.hist(data, 100, weights=weights, histtype='stepfilled', log=True)
ax = plt.subplot(4, 1, 4)
- plt.hist(data_big, 100, histtype='stepfilled', log=True, orientation='horizontal')
+ plt.hist(data_big, 100, histtype='stepfilled', log=True,
+ orientation='horizontal')
@image_comparison(baseline_images=['hist_step_filled'], remove_text=True,
@@ -1464,7 +1488,8 @@ def _as_mpl_axes(self):
ax_via_gca = plt.gca(projection=prj2)
assert ax_via_gca is not ax
assert ax.get_theta_offset() == 0, ax.get_theta_offset()
- assert ax_via_gca.get_theta_offset() == np.pi, ax_via_gca.get_theta_offset()
+ assert ax_via_gca.get_theta_offset() == np.pi, \
+ ax_via_gca.get_theta_offset()
# try getting the axes given an == (not is) polar projection
ax_via_gca = plt.gca(projection=prj3)
assert ax_via_gca is ax
@@ -1501,7 +1526,7 @@ def test_stackplot():
ax.set_ylim((0, 70))
# Reuse testcase from above for a labeled data test
- data={"x": x, "y1": y1, "y2": y2, "y3": y3}
+ data = {"x": x, "y1": y1, "y2": y2, "y3": y3}
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.stackplot("x", "y1", "y2", "y3", data=data)
@@ -1529,7 +1554,7 @@ def bump(a):
return a
d = layers(3, 100)
- d[50,:] = 0 # test for fixed weighted wiggle (issue #6313)
+ d[50, :] = 0 # test for fixed weighted wiggle (issue #6313)
fig = plt.figure()
@@ -2005,6 +2030,7 @@ def test_boxplot_autorange_whiskers():
ax2.boxplot([x, x], bootstrap=10000, notch=1, autorange=True)
ax2.set_ylim((-5, 5))
+
def _rc_test_bxp_helper(ax, rc_dict):
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
@@ -2012,6 +2038,7 @@ def _rc_test_bxp_helper(ax, rc_dict):
ax.boxplot([x, x])
return ax
+
@image_comparison(baseline_images=['boxplot_rc_parameters'],
savefig_kwarg={'dpi': 100}, remove_text=True,
tol=1, style='default')
@@ -2022,7 +2049,7 @@ def test_boxplot_rc_parameters():
fig, ax = plt.subplots(3)
rc_axis0 = {
- 'boxplot.notch':True,
+ 'boxplot.notch': True,
'boxplot.whiskers': [5, 95],
'boxplot.bootstrap': 10000,
@@ -2407,7 +2434,6 @@ def test_errorbar():
fig.suptitle('Variable errorbars')
-
# Reuse te first testcase from above for a labeled data test
data = {"x": x, "y": y}
fig = plt.figure()
@@ -2510,7 +2536,8 @@ def test_hist_offset():
ax.hist(d2, bottom=15)
-@image_comparison(baseline_images=['hist_step'], extensions=['png'], remove_text=True)
+@image_comparison(baseline_images=['hist_step'], extensions=['png'],
+ remove_text=True)
def test_hist_step():
# make some data
d1 = np.linspace(1, 3, 20)
@@ -2599,7 +2626,8 @@ def test_hist_stacked_normed():
ax.hist((d1, d2), stacked=True, normed=True)
-@image_comparison(baseline_images=['hist_step_bottom'], extensions=['png'], remove_text=True)
+@image_comparison(baseline_images=['hist_step_bottom'], extensions=['png'],
+ remove_text=True)
def test_hist_step_bottom():
# make some data
d1 = np.linspace(1, 3, 20)
@@ -2622,7 +2650,8 @@ def test_hist_stacked_bar():
labels = ['green', 'orange', ' yellow', 'magenta', 'black']
fig = plt.figure()
ax = fig.add_subplot(111)
- ax.hist(d, bins=10, histtype='barstacked', align='mid', color=colors, label=labels)
+ ax.hist(d, bins=10, histtype='barstacked', align='mid', color=colors,
+ label=labels)
ax.legend(loc='upper right', bbox_to_anchor=(1.0, 1.0), ncol=1)
@@ -2653,11 +2682,12 @@ def test_rgba_markers():
for j, rcolor in enumerate(rcolors):
for k, bcolor in enumerate(bcolors):
axs[i].plot(j+1, k+1, 'o', mfc=bcolor, mec=rcolor,
- alpha=alpha, **kw)
+ alpha=alpha, **kw)
axs[i].plot(j+1, k+3, 'x', mec=rcolor, alpha=alpha, **kw)
for ax in axs:
ax.axis([-1, 4, 0, 5])
+
@image_comparison(baseline_images=['mollweide_grid'], remove_text=True)
def test_mollweide_grid():
# test that both horizontal and vertical gridlines appear on the Mollweide
@@ -2788,7 +2818,8 @@ def test_eventplot():
assert num_collections == num_datasets
-@image_comparison(baseline_images=['test_eventplot_defaults'], extensions=['png'], remove_text=True)
+@image_comparison(baseline_images=['test_eventplot_defaults'],
+ extensions=['png'], remove_text=True)
def test_eventplot_defaults():
'''
test that eventplot produces the correct output given the default params
@@ -2805,7 +2836,8 @@ def test_eventplot_defaults():
colls = axobj.eventplot(data)
-@image_comparison(baseline_images=['test_eventplot_problem_kwargs'], extensions=['png'], remove_text=True)
+@image_comparison(baseline_images=['test_eventplot_problem_kwargs'],
+ extensions=['png'], remove_text=True)
def test_eventplot_problem_kwargs():
'''
test that 'singular' versions of LineCollection props raise an
@@ -2842,14 +2874,15 @@ def test_empty_eventplot():
plt.draw()
-@image_comparison(baseline_images=['marker_styles'], extensions=['png'], remove_text=True)
+@image_comparison(baseline_images=['marker_styles'], extensions=['png'],
+ remove_text=True)
def test_marker_styles():
fig = plt.figure()
ax = fig.add_subplot(111)
for y, marker in enumerate(sorted(matplotlib.markers.MarkerStyle.markers,
key=lambda x: str(type(x))+str(x))):
- ax.plot((y % 2)*5 + np.arange(10)*10, np.ones(10)*10*y, linestyle='', marker=marker,
- markersize=10+y/5, label=marker)
+ ax.plot((y % 2)*5 + np.arange(10)*10, np.ones(10)*10*y, linestyle='',
+ marker=marker, markersize=10+y/5, label=marker)
@image_comparison(baseline_images=['rc_markerfill'], extensions=['png'])
@@ -2857,7 +2890,7 @@ def test_markers_fillstyle_rcparams():
fig, ax = plt.subplots()
x = np.arange(7)
for idx, (style, marker) in enumerate(
- [('top', 's'), ('bottom', 'o'), ('none', '^')]):
+ [('top', 's'), ('bottom', 'o'), ('none', '^')]):
matplotlib.rcParams['markers.fillstyle'] = style
ax.plot(x+idx, marker=marker)
@@ -3937,9 +3970,9 @@ def make_patch_spines_invisible(ax):
# Offset the right spine of par2. The ticks and label have already been
# placed on the right by twinx above.
par2.spines["right"].set_position(("axes", 1.2))
- # Having been created by twinx, par2 has its frame off, so the line of its
- # detached spine is invisible. First, activate the frame but make the patch
- # and spines invisible.
+ # Having been created by twinx, par2 has its frame off, so the line of
+ # its detached spine is invisible. First, activate the frame but make
+ # the patch and spines invisible.
make_patch_spines_invisible(par2)
# Second, show the right spine.
par2.spines["right"].set_visible(True)
@@ -4094,8 +4127,8 @@ def test_pie_linewidth_0():
fig = plt.figure()
ax = fig.gca()
ax.pie("s", explode="ex", labels="l", colors="c",
- autopct='%1.1f%%', shadow=True, startangle=90,
- wedgeprops={'linewidth': 0}, data=data)
+ autopct='%1.1f%%', shadow=True, startangle=90,
+ wedgeprops={'linewidth': 0}, data=data)
ax.axis('equal')
# And again to test the pyplot functions which should also be able to be
@@ -4113,13 +4146,13 @@ def test_pie_center_radius():
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
- explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
+ explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
plt.pie(sizes, explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', shadow=True, startangle=90,
- wedgeprops={'linewidth': 0}, center=(1,2), radius=1.5)
+ wedgeprops={'linewidth': 0}, center=(1, 2), radius=1.5)
- plt.annotate("Center point", xy=(1,2), xytext=(1,1.5),
+ plt.annotate("Center point", xy=(1, 2), xytext=(1, 1.5),
arrowprops=dict(arrowstyle="->",
connectionstyle="arc3"))
# Set aspect ratio to be equal so that pie is drawn as a circle.
@@ -4199,10 +4232,10 @@ def test_set_get_ticklabels():
ax[0].set_xticklabels(('a', 'b', 'c', 'd'))
ax[0].set_yticklabels(('11', '12', '13', '14'))
- # set ticklabel to the other plot, expect the 2 plots have same label setting
- # pass get_ticklabels return value as ticklabels argument
- ax[1].set_xticklabels(ax[0].get_xticklabels() )
- ax[1].set_yticklabels(ax[0].get_yticklabels() )
+ # set ticklabel to the other plot, expect the 2 plots have same label
+ # setting pass get_ticklabels return value as ticklabels argument
+ ax[1].set_xticklabels(ax[0].get_xticklabels())
+ ax[1].set_yticklabels(ax[0].get_yticklabels())
@image_comparison(baseline_images=['o_marker_path_snap'], extensions=['png'],
@@ -4259,7 +4292,7 @@ def test_pathological_hexbin():
def test_color_None():
# issue 3855
fig, ax = plt.subplots()
- ax.plot([1,2], [1,2], color=None)
+ ax.plot([1, 2], [1, 2], color=None)
def test_color_alias():
@@ -4298,13 +4331,13 @@ def test_move_offsetlabel():
@image_comparison(baseline_images=['rc_spines'], extensions=['png'],
- savefig_kwarg={'dpi':40})
+ savefig_kwarg={'dpi': 40})
def test_rc_spines():
rc_dict = {
- 'axes.spines.left':False,
- 'axes.spines.right':False,
- 'axes.spines.top':False,
- 'axes.spines.bottom':False}
+ 'axes.spines.left': False,
+ 'axes.spines.right': False,
+ 'axes.spines.top': False,
+ 'axes.spines.bottom': False}
with matplotlib.rc_context(rc_dict):
fig, ax = plt.subplots()
@@ -4343,15 +4376,15 @@ def test_rc_tick():
xax = ax1.xaxis
yax = ax1.yaxis
# tick1On bottom/left
- assert xax._major_tick_kw['tick1On'] == False
- assert xax._major_tick_kw['tick2On'] == True
- assert xax._minor_tick_kw['tick1On'] == False
- assert xax._minor_tick_kw['tick2On'] == True
+ assert not xax._major_tick_kw['tick1On']
+ assert xax._major_tick_kw['tick2On']
+ assert not xax._minor_tick_kw['tick1On']
+ assert xax._minor_tick_kw['tick2On']
- assert yax._major_tick_kw['tick1On'] == True
- assert yax._major_tick_kw['tick2On'] == False
- assert yax._minor_tick_kw['tick1On'] == True
- assert yax._minor_tick_kw['tick2On'] == False
+ assert yax._major_tick_kw['tick1On']
+ assert not yax._major_tick_kw['tick2On']
+ assert yax._minor_tick_kw['tick1On']
+ assert not yax._minor_tick_kw['tick2On']
def test_rc_major_minor_tick():
@@ -4366,15 +4399,15 @@ def test_rc_major_minor_tick():
xax = ax1.xaxis
yax = ax1.yaxis
# tick1On bottom/left
- assert xax._major_tick_kw['tick1On'] == False
- assert xax._major_tick_kw['tick2On'] == True
- assert xax._minor_tick_kw['tick1On'] == False
- assert xax._minor_tick_kw['tick2On'] == True
+ assert not xax._major_tick_kw['tick1On']
+ assert xax._major_tick_kw['tick2On']
+ assert not xax._minor_tick_kw['tick1On']
+ assert xax._minor_tick_kw['tick2On']
- assert yax._major_tick_kw['tick1On'] == False
- assert yax._major_tick_kw['tick2On'] == True
- assert yax._minor_tick_kw['tick1On'] == False
- assert yax._minor_tick_kw['tick2On'] == True
+ assert not yax._major_tick_kw['tick1On']
+ assert yax._major_tick_kw['tick2On']
+ assert not yax._minor_tick_kw['tick1On']
+ assert yax._minor_tick_kw['tick2On']
def test_bar_negative_width():
@@ -4687,7 +4720,8 @@ def test_pandas_indexing_hist():
def test_axis_set_tick_params_labelsize_labelcolor():
# Tests fix for issue 4346
axis_1 = plt.subplot()
- axis_1.yaxis.set_tick_params(labelsize=30, labelcolor='red', direction='out')
+ axis_1.yaxis.set_tick_params(labelsize=30, labelcolor='red',
+ direction='out')
# Expected values after setting the ticks
assert axis_1.yaxis.majorTicks[0]._size == 4.0
diff --git a/lib/matplotlib/tests/test_collections.py b/lib/matplotlib/tests/test_collections.py
index be1e5fce3d8b..af9dabc904c1 100644
--- a/lib/matplotlib/tests/test_collections.py
+++ b/lib/matplotlib/tests/test_collections.py
@@ -383,16 +383,6 @@ def check_segments(coll, positions, linelength, lineoffset, orientation):
assert_equal(segment[1, pos2], positions[i])
-def check_allprop(values, target):
- '''
- check to make sure all values match the given target
-
- note: this is not a test, it is used by tests
- '''
- for value in values:
- assert_equal(value, target)
-
-
def check_allprop_array(values, target):
'''
check to make sure all values match the given target if arrays
diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py
index dd17358edeb7..e455bd4c07b8 100644
--- a/lib/matplotlib/tests/test_contour.py
+++ b/lib/matplotlib/tests/test_contour.py
@@ -158,7 +158,7 @@ def test_contour_manual_labels():
@image_comparison(baseline_images=['contour_labels_size_color'],
extensions=['png'], remove_text=True)
-def test_contour_manual_labels():
+def test_contour_labels_size_color():
x, y = np.meshgrid(np.arange(0, 10), np.arange(0, 10))
z = np.max(np.dstack([abs(x), abs(y)]), 2)
diff --git a/lib/matplotlib/tests/test_mlab.py b/lib/matplotlib/tests/test_mlab.py
index 565df780e86a..9f77df82e472 100644
--- a/lib/matplotlib/tests/test_mlab.py
+++ b/lib/matplotlib/tests/test_mlab.py
@@ -955,73 +955,6 @@ def test_detrend_mean_2D_axism1(self):
assert_allclose(res, targ,
atol=1e-08)
- def test_detrend_mean_2D_none(self):
- arri = [self.sig_off,
- self.sig_base + self.sig_off]
- arrt = [self.sig_zeros,
- self.sig_base]
- input = np.vstack(arri)
- targ = np.vstack(arrt)
- res = mlab.detrend_mean(input, axis=None)
- assert_allclose(res, targ,
- atol=1e-08)
-
- def test_detrend_mean_2D_none_T(self):
- arri = [self.sig_off,
- self.sig_base + self.sig_off]
- arrt = [self.sig_zeros,
- self.sig_base]
- input = np.vstack(arri).T
- targ = np.vstack(arrt)
- res = mlab.detrend_mean(input, axis=None)
- assert_allclose(res.T, targ,
- atol=1e-08)
-
- def test_detrend_mean_2D_axis0(self):
- arri = [self.sig_base,
- self.sig_base + self.sig_off,
- self.sig_base + self.sig_slope,
- self.sig_base + self.sig_off + self.sig_slope]
- arrt = [self.sig_base,
- self.sig_base,
- self.sig_base + self.sig_slope_mean,
- self.sig_base + self.sig_slope_mean]
- input = np.vstack(arri).T
- targ = np.vstack(arrt).T
- res = mlab.detrend_mean(input, axis=0)
- assert_allclose(res, targ,
- atol=1e-08)
-
- def test_detrend_mean_2D_axis1(self):
- arri = [self.sig_base,
- self.sig_base + self.sig_off,
- self.sig_base + self.sig_slope,
- self.sig_base + self.sig_off + self.sig_slope]
- arrt = [self.sig_base,
- self.sig_base,
- self.sig_base + self.sig_slope_mean,
- self.sig_base + self.sig_slope_mean]
- input = np.vstack(arri)
- targ = np.vstack(arrt)
- res = mlab.detrend_mean(input, axis=1)
- assert_allclose(res, targ,
- atol=1e-08)
-
- def test_detrend_mean_2D_axism1(self):
- arri = [self.sig_base,
- self.sig_base + self.sig_off,
- self.sig_base + self.sig_slope,
- self.sig_base + self.sig_off + self.sig_slope]
- arrt = [self.sig_base,
- self.sig_base,
- self.sig_base + self.sig_slope_mean,
- self.sig_base + self.sig_slope_mean]
- input = np.vstack(arri)
- targ = np.vstack(arrt)
- res = mlab.detrend_mean(input, axis=-1)
- assert_allclose(res, targ,
- atol=1e-08)
-
def test_detrend_2D_default(self):
arri = [self.sig_off,
self.sig_base + self.sig_off]
diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py
index 4f1ab2515c35..de3b30cb5966 100644
--- a/lib/matplotlib/tests/test_pickle.py
+++ b/lib/matplotlib/tests/test_pickle.py
@@ -1,7 +1,6 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)
-import six
from six.moves import cPickle as pickle
from six.moves import range
@@ -15,88 +14,8 @@
import matplotlib.transforms as mtransforms
-def depth_getter(obj,
- current_depth=0,
- depth_stack=None,
- nest_info='top level object'):
- """
- Returns a dictionary mapping:
-
- id(obj): (shallowest_depth, obj, nest_info)
-
- for the given object (and its subordinates).
-
- This, in conjunction with recursive_pickle, can be used to debug
- pickling issues, although finding others is sometimes a case of
- trial and error.
-
- """
- if depth_stack is None:
- depth_stack = {}
-
- if id(obj) in depth_stack:
- stack = depth_stack[id(obj)]
- if stack[0] > current_depth:
- del depth_stack[id(obj)]
- else:
- return depth_stack
-
- depth_stack[id(obj)] = (current_depth, obj, nest_info)
-
- if isinstance(obj, (list, tuple)):
- for i, item in enumerate(obj):
- depth_getter(item, current_depth=current_depth + 1,
- depth_stack=depth_stack,
- nest_info=('list/tuple item #%s in '
- '(%s)' % (i, nest_info)))
- else:
- if isinstance(obj, dict):
- state = obj
- elif hasattr(obj, '__getstate__'):
- state = obj.__getstate__()
- if not isinstance(state, dict):
- state = {}
- elif hasattr(obj, '__dict__'):
- state = obj.__dict__
- else:
- state = {}
-
- for key, value in six.iteritems(state):
- depth_getter(value, current_depth=current_depth + 1,
- depth_stack=depth_stack,
- nest_info=('attribute "%s" in '
- '(%s)' % (key, nest_info)))
-
- return depth_stack
-
-
-def recursive_pickle(top_obj):
- """
- Recursively pickle all of the given objects subordinates, starting with
- the deepest first. **Very** handy for debugging pickling issues, but
- also very slow (as it literally pickles each object in turn).
-
- Handles circular object references gracefully.
-
- """
- objs = depth_getter(top_obj)
- # sort by depth then by nest_info
- objs = sorted(six.itervalues(objs), key=lambda val: (-val[0], val[2]))
-
- for _, obj, location in objs:
- try:
- pickle.dump(obj, BytesIO(), pickle.HIGHEST_PROTOCOL)
- except Exception as err:
- print(obj)
- print('Failed to pickle %s. \n Type: %s. Traceback '
- 'follows:' % (location, type(obj)))
- raise
-
-
def test_simple():
fig = plt.figure()
- # un-comment to debug
-# recursive_pickle(fig)
pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL)
ax = plt.subplot(121)
@@ -106,13 +25,9 @@ def test_simple():
plt.plot(np.arange(10), label='foobar')
plt.legend()
- # Uncomment to debug any unpicklable objects. This is slow so is not
- # uncommented by default.
-# recursive_pickle(fig)
pickle.dump(ax, BytesIO(), pickle.HIGHEST_PROTOCOL)
# ax = plt.subplot(121, projection='hammer')
-# recursive_pickle(ax, 'figure')
# pickle.dump(ax, BytesIO(), pickle.HIGHEST_PROTOCOL)
plt.figure()
@@ -138,8 +53,9 @@ def test_complete():
data = u = v = np.linspace(0, 10, 80).reshape(10, 8)
v = np.sin(v * -0.6)
+ # Ensure lists also pickle correctly.
plt.subplot(3, 3, 1)
- plt.plot(list(range(10))) # Ensure lists also pickle correctly.
+ plt.plot(list(range(10)))
plt.subplot(3, 3, 2)
plt.contourf(data, hatches=['//', 'ooo'])
@@ -171,11 +87,9 @@ def test_complete():
plt.subplot(3, 3, 9)
plt.errorbar(x, x * -0.5, xerr=0.2, yerr=0.4)
- ###### plotting is done, now test its pickle-ability #########
-
- # Uncomment to debug any unpicklable objects. This is slow (~200 seconds).
-# recursive_pickle(fig)
-
+ #
+ # plotting is done, now test its pickle-ability
+ #
result_fh = BytesIO()
pickle.dump(fig, result_fh, pickle.HIGHEST_PROTOCOL)
@@ -227,7 +141,6 @@ def test_image():
def test_polar():
ax = plt.subplot(111, polar=True)
fig = plt.gcf()
- result = BytesIO()
pf = pickle.dumps(fig)
pickle.loads(pf)
plt.draw()
diff --git a/lib/matplotlib/tests/test_ticker.py b/lib/matplotlib/tests/test_ticker.py
index d6eee0d6d7bd..524ab750133e 100644
--- a/lib/matplotlib/tests/test_ticker.py
+++ b/lib/matplotlib/tests/test_ticker.py
@@ -239,56 +239,6 @@ def test_use_offset(self, use_offset):
assert use_offset == tmp_form.get_useOffset()
-class TestLogFormatter(object):
- def _sub_labels(self, axis, subs=()):
- "Test whether locator marks subs to be labeled"
- fmt = axis.get_minor_formatter()
- minor_tlocs = axis.get_minorticklocs()
- fmt.set_locs(minor_tlocs)
- coefs = minor_tlocs / 10**(np.floor(np.log10(minor_tlocs)))
- label_expected = [np.round(c) in subs for c in coefs]
- label_test = [fmt(x) != '' for x in minor_tlocs]
- assert label_test == label_expected
-
- @pytest.mark.style('default')
- def test_sublabel(self):
- # test label locator
- fig, ax = plt.subplots()
- ax.set_xscale('log')
- ax.xaxis.set_major_locator(mticker.LogLocator(base=10, subs=[]))
- ax.xaxis.set_minor_locator(mticker.LogLocator(base=10,
- subs=np.arange(2, 10)))
- ax.xaxis.set_major_formatter(mticker.LogFormatter(labelOnlyBase=True))
- ax.xaxis.set_minor_formatter(mticker.LogFormatter(labelOnlyBase=False))
- # axis range above 3 decades, only bases are labeled
- ax.set_xlim(1, 1e4)
- fmt = ax.xaxis.get_major_formatter()
- fmt.set_locs(ax.xaxis.get_majorticklocs())
- show_major_labels = [fmt(x) != ''
- for x in ax.xaxis.get_majorticklocs()]
- assert np.all(show_major_labels)
- self._sub_labels(ax.xaxis, subs=[])
-
- # For the next two, if the numdec threshold in LogFormatter.set_locs
- # were 3, then the label sub would be 3 for 2-3 decades and (2,5)
- # for 1-2 decades. With a threshold of 1, subs are not labeled.
- # axis range at 2 to 3 decades
- ax.set_xlim(1, 800)
- self._sub_labels(ax.xaxis, subs=[])
-
- # axis range at 1 to 2 decades
- ax.set_xlim(1, 80)
- self._sub_labels(ax.xaxis, subs=[])
-
- # axis range at 0.4 to 1 decades, label subs 2, 3, 4, 6
- ax.set_xlim(1, 8)
- self._sub_labels(ax.xaxis, subs=[2, 3, 4, 6])
-
- # axis range at 0 to 0.4 decades, label all
- ax.set_xlim(0.5, 0.9)
- self._sub_labels(ax.xaxis, subs=np.arange(2, 10, dtype=int))
-
-
class FakeAxis(object):
"""Allow Formatter to be called without having a "full" plot set up."""
def __init__(self, vmin=1, vmax=10):
@@ -503,6 +453,54 @@ def test_pprint(self, value, domain, expected):
label = fmt.pprint_val(value, domain)
assert label == expected
+ def _sub_labels(self, axis, subs=()):
+ "Test whether locator marks subs to be labeled"
+ fmt = axis.get_minor_formatter()
+ minor_tlocs = axis.get_minorticklocs()
+ fmt.set_locs(minor_tlocs)
+ coefs = minor_tlocs / 10**(np.floor(np.log10(minor_tlocs)))
+ label_expected = [np.round(c) in subs for c in coefs]
+ label_test = [fmt(x) != '' for x in minor_tlocs]
+ assert label_test == label_expected
+
+ @pytest.mark.style('default')
+ def test_sublabel(self):
+ # test label locator
+ fig, ax = plt.subplots()
+ ax.set_xscale('log')
+ ax.xaxis.set_major_locator(mticker.LogLocator(base=10, subs=[]))
+ ax.xaxis.set_minor_locator(mticker.LogLocator(base=10,
+ subs=np.arange(2, 10)))
+ ax.xaxis.set_major_formatter(mticker.LogFormatter(labelOnlyBase=True))
+ ax.xaxis.set_minor_formatter(mticker.LogFormatter(labelOnlyBase=False))
+ # axis range above 3 decades, only bases are labeled
+ ax.set_xlim(1, 1e4)
+ fmt = ax.xaxis.get_major_formatter()
+ fmt.set_locs(ax.xaxis.get_majorticklocs())
+ show_major_labels = [fmt(x) != ''
+ for x in ax.xaxis.get_majorticklocs()]
+ assert np.all(show_major_labels)
+ self._sub_labels(ax.xaxis, subs=[])
+
+ # For the next two, if the numdec threshold in LogFormatter.set_locs
+ # were 3, then the label sub would be 3 for 2-3 decades and (2,5)
+ # for 1-2 decades. With a threshold of 1, subs are not labeled.
+ # axis range at 2 to 3 decades
+ ax.set_xlim(1, 800)
+ self._sub_labels(ax.xaxis, subs=[])
+
+ # axis range at 1 to 2 decades
+ ax.set_xlim(1, 80)
+ self._sub_labels(ax.xaxis, subs=[])
+
+ # axis range at 0.4 to 1 decades, label subs 2, 3, 4, 6
+ ax.set_xlim(1, 8)
+ self._sub_labels(ax.xaxis, subs=[2, 3, 4, 6])
+
+ # axis range at 0 to 0.4 decades, label all
+ ax.set_xlim(0.5, 0.9)
+ self._sub_labels(ax.xaxis, subs=np.arange(2, 10, dtype=int))
+
class TestFormatStrFormatter(object):
def test_basic(self):
diff --git a/lib/matplotlib/tests/test_triangulation.py b/lib/matplotlib/tests/test_triangulation.py
index a32061801b52..831a01c97efc 100644
--- a/lib/matplotlib/tests/test_triangulation.py
+++ b/lib/matplotlib/tests/test_triangulation.py
@@ -1,8 +1,6 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)
-import six
-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as mtri
@@ -17,6 +15,7 @@
import sys
on_win = (sys.platform == 'win32')
+
def test_delaunay():
# No duplicate points, regular grid.
nx = 5
@@ -236,10 +235,15 @@ def test_trifinder():
tris = trifinder(xs, ys)
assert_array_equal(tris, [0, 17])
+ #
# Test triangles with horizontal colinear points. These are not valid
# triangulations, but we try to deal with the simplest violations.
- delta = 0.0 # If +ve, triangulation is OK, if -ve triangulation invalid,
- # if zero have colinear points but should pass tests anyway.
+ #
+
+ # If +ve, triangulation is OK, if -ve triangulation invalid,
+ # if zero have colinear points but should pass tests anyway.
+ delta = 0.0
+
x = [1.5, 0, 1, 2, 3, 1.5, 1.5]
y = [-1, 0, 0, 0, 0, delta, 1]
triangles = [[0, 2, 1], [0, 3, 2], [0, 4, 3], [1, 2, 5], [2, 3, 5],
@@ -254,10 +258,15 @@ def test_trifinder():
assert_array_equal(tris, [[-1, 0, 0, 1, 1, 2, -1],
[-1, 6, 6, 6, 7, 7, -1]])
+ #
# Test triangles with vertical colinear points. These are not valid
# triangulations, but we try to deal with the simplest violations.
- delta = 0.0 # If +ve, triangulation is OK, if -ve triangulation invalid,
- # if zero have colinear points but should pass tests anyway.
+ #
+
+ # If +ve, triangulation is OK, if -ve triangulation invalid,
+ # if zero have colinear points but should pass tests anyway.
+ delta = 0.0
+
x = [-1, -delta, 0, 0, 0, 0, 1]
y = [1.5, 1.5, 0, 1, 2, 3, 1.5]
triangles = [[0, 1, 2], [0, 1, 5], [1, 2, 3], [1, 3, 4], [1, 4, 5],
@@ -281,7 +290,7 @@ def test_trifinder():
trifinder = triang.get_trifinder()
xs = [-0.2, 0.2, 0.8, 1.2]
- ys = [ 0.5, 0.5, 0.5, 0.5]
+ ys = [0.5, 0.5, 0.5, 0.5]
tris = trifinder(xs, ys)
assert_array_equal(tris, [-1, 0, 1, -1])
@@ -591,8 +600,10 @@ def test_triinterp_colinear():
# We also test interpolation inside a flat triangle, by forcing
# *tri_index* in a call to :meth:`_interpolate_multikeys`.
- delta = 0. # If +ve, triangulation is OK, if -ve triangulation invalid,
- # if zero have colinear points but should pass tests anyway.
+ # If +ve, triangulation is OK, if -ve triangulation invalid,
+ # if zero have colinear points but should pass tests anyway.
+ delta = 0.
+
x0 = np.array([1.5, 0, 1, 2, 3, 1.5, 1.5])
y0 = np.array([-1, 0, 0, 0, 0, delta, 1])
@@ -966,8 +977,8 @@ def test_triplot_return():
triang = mtri.Triangulation(
[0.0, 1.0, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0],
triangles=[[0, 1, 3], [3, 2, 0]])
- if ax.triplot(triang, "b-") is None:
- raise AssertionError("triplot should return the artist it adds")
+ assert ax.triplot(triang, "b-") is not None, \
+ 'triplot should return the artist it adds'
def test_trirefiner_fortran_contiguous_triangles():
diff --git a/lib/matplotlib/tests/test_widgets.py b/lib/matplotlib/tests/test_widgets.py
index 5fb41eb26b40..e8b7d8aebc7e 100644
--- a/lib/matplotlib/tests/test_widgets.py
+++ b/lib/matplotlib/tests/test_widgets.py
@@ -261,9 +261,7 @@ def test_CheckButtons():
check.set_active(0)
assert check.get_status() == [False, False, True]
- def clicked_function():
- pass
- cid = check.on_clicked(clicked_function)
+ cid = check.on_clicked(lambda: None)
check.disconnect(cid)
diff --git a/pytest.ini b/pytest.ini
index d9132bfa6002..ee59757e96ae 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -44,13 +44,11 @@ pep8ignore =
matplotlib/testing/jpl_units/UnitDbl.py E201 E202 E203
matplotlib/testing/jpl_units/UnitDblConverter.py E201 E202 E203 E251 E302 E501 E711
matplotlib/testing/jpl_units/UnitDblFormatter.py E201 E202 E251 E302
- matplotlib/tests/test_axes.py E101 E202 E225 E231 E261 E302 E303 E501 E712 W191
matplotlib/tests/test_image.py E225 E231 E251 E302 E303 E501 E502
matplotlib/tests/test_lines.py E231 E261
matplotlib/tests/test_mathtext.py E261 E302 E501
matplotlib/tests/test_rcparams.py E231 E501
matplotlib/tests/test_tightlayout.py E302
- matplotlib/tests/test_triangulation.py E201 E302
matplotlib/tri/triinterpolate.py E201 E221
matplotlib/_cm.py E101 E202 E203 W191
matplotlib/_mathtext_data.py E203 E231 E261 E501