Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25b1d43

Browse files
committed
TST: test pyplot.pie with a data kwarg
pie was a method, which did not work with a data kwarg as it didn't have a **kwargs catch all which would make pyplot.pie pass this argument to the decorated function. Document that the decorated functions are tested in the axes test cases.
1 parent b6cb12f commit 25b1d43

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,7 +3726,8 @@ def test_text_labelsize():
37263726
ax.tick_params(direction='out')
37273727

37283728

3729-
@image_comparison(baseline_images=['pie_linewidth_0', 'pie_linewidth_0'],
3729+
@image_comparison(baseline_images=['pie_linewidth_0', 'pie_linewidth_0',
3730+
'pie_linewidth_0'],
37303731
extensions=['png'])
37313732
def test_pie_linewidth_0():
37323733
# The slices will be ordered and plotted counter-clockwise.
@@ -3743,14 +3744,21 @@ def test_pie_linewidth_0():
37433744

37443745
# Reuse testcase from above for a labeled data test
37453746
data = {"l": labels, "s": sizes, "c": colors, "ex": explode}
3746-
# FIXME: Workaround until the pyplot is regenerated
37473747
fig = plt.figure()
37483748
ax = fig.gca()
37493749
ax.pie("s", explode="ex", labels="l", colors="c",
37503750
autopct='%1.1f%%', shadow=True, startangle=90,
37513751
wedgeprops={'linewidth': 0}, data=data)
37523752
ax.axis('equal')
37533753

3754+
# And again to test the pyplot functions which should also be able to be
3755+
# called with a data kwarg
3756+
plt.figure()
3757+
plt.pie("s", explode="ex", labels="l", colors="c",
3758+
autopct='%1.1f%%', shadow=True, startangle=90,
3759+
wedgeprops={'linewidth': 0}, data=data)
3760+
plt.axis('equal')
3761+
37543762

37553763
@image_comparison(baseline_images=['pie_center_radius'], extensions=['png'])
37563764
def test_pie_center_radius():

lib/matplotlib/tests/test_labeled_data_unpacking.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ def noop(txt, regex):
3030
def is_list_like(obj):
3131
return not is_string_like(obj) and iterable(obj)
3232

33+
# Notes on testing the plotting functions itself
34+
# * the individual decorated plotting functions are tested in 'test_axes.py'
35+
# * that pyplot functions accept a data kwarg is only tested in
36+
# test_axes.test_pie_linewidth_0
37+
3338

3439
# stolen from pandas
3540
@contextmanager

0 commit comments

Comments
 (0)