Skip to content

WIP: issue #5325, convert from nose to pytest #5405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 174 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
4c39e53
ENH: use pytest instead of nose.
pizzathief Oct 31, 2015
f10a36b
pytest.raises(), not pytest.raise()
pizzathief Nov 4, 2015
c17005b
pytest.raises() calls needed some massaging
pizzathief Nov 4, 2015
1a75b75
replace nose with pytest in INSTALL
pizzathief Nov 4, 2015
b123ed7
altering more assert_equal calls.
pizzathief Nov 4, 2015
5f433fb
fixing up problems with assert, and the use of messages.
pizzathief Nov 5, 2015
cfb8d71
flake8 failures
pizzathief Nov 5, 2015
89d3366
flake8 doesn't like blank lines at ends of files.
pizzathief Nov 5, 2015
887e482
flake8 fixes
pizzathief Nov 5, 2015
8f16316
fixed syntax errors
pizzathief Nov 5, 2015
b56297f
just have it on one line
pizzathief Nov 5, 2015
df4e413
fix errors highlighted in travis CI logs
pizzathief Nov 5, 2015
defa65d
fixing reported test failures, reported by pytest on travis.
pizzathief Nov 5, 2015
b8b3909
fixing pytest failures. Interesting that assert can't seem to handle
pizzathief Nov 5, 2015
5fd4351
fixing syntax failures
pizzathief Nov 5, 2015
47c968b
Force travis to install pytest, and plugins
pizzathief Nov 5, 2015
1b509c1
get travis to run py.test instead of nose.
pizzathief Nov 6, 2015
432e9e8
small pep8 fix to force travis to build
pizzathief Nov 6, 2015
60b038c
lets see if indenting a comment fixes the problem
pizzathief Nov 6, 2015
2984d44
give py.test the install location of the module, rather
pizzathief Nov 7, 2015
e27451d
forgot to remove the bad py.test call.
pizzathief Nov 7, 2015
784fdf8
force pytest-pep8 to ignore the pep8 warnings that
pizzathief Nov 7, 2015
f035db7
temporarily adding more items to be ignored by pep8,
pizzathief Nov 7, 2015
1e7b62c
trying out --pyargs as requested, also removing pep checks,
pizzathief Nov 7, 2015
56d99ed
tests.py should now act more like the old nose version did,
pizzathief Nov 8, 2015
7d38aa3
lets try the 'gdb python tests.py' method again.
pizzathief Nov 8, 2015
7bbc04a
the switches that nose needed , make pytest fail, so lets
pizzathief Nov 8, 2015
05da48a
pytest.main doesn't like --pyargs now? it used to..
pizzathief Nov 9, 2015
98b1e69
Adding in all tests to the list, including argv[1:]
pizzathief Nov 13, 2015
6853e71
seems --processes=2 and --process-timeout=300
pizzathief Nov 13, 2015
105a15d
replace assert_raises with pytest.raises
pizzathief Nov 13, 2015
5482cc7
another assert_raises to replace with pytest.raises
pizzathief Nov 13, 2015
4a8caad
replace assert_raises with pytest.raises
pizzathief Nov 13, 2015
8985c35
Fixing errors that appear before testing starts
pizzathief Nov 13, 2015
789f864
replaced a nose function for known failing tests
pizzathief Nov 13, 2015
4900796
updating basic tests that are know to fail with
pizzathief Nov 14, 2015
0633576
add the ability to only run pep8 tests. remove commented out means
pizzathief Nov 18, 2015
47ef9f0
ass civerage report as standard
pizzathief Nov 18, 2015
2a7637c
no need for the nose pep8 tests, so remove from tests.py
pizzathief Nov 18, 2015
08ae5ef
pep8 and non-pep8 tests act better now. taking out
pizzathief Nov 25, 2015
bd0c061
remove more of the nose infrastructure
pizzathief Nov 27, 2015
42e7ae1
Pass the exit code of pytest.main back to the shell.
pizzathief Dec 13, 2015
86820be
replace nose decorator with pytest code.
pizzathief Dec 13, 2015
37c67c2
whoops, deleted an 'a' from a variable while doing
pizzathief Dec 13, 2015
84359ac
fix up a bunch of pytest.raises calls.
pizzathief Dec 13, 2015
c76bef9
found 'assert_less' calls to replace
pizzathief Dec 13, 2015
2e58461
found a space and comma char that had attempted an escape of the faci…
pizzathief Dec 13, 2015
517b232
found some assert_equal statements to convert.
pizzathief Dec 13, 2015
9aee1fc
converted assert_raises calls to pytest.raises.
pizzathief Dec 13, 2015
91f3032
more assert_raises calls to replace
pizzathief Dec 13, 2015
86f7264
Thanks to QuLogic , using decorator form of pytest.raises for
pizzathief Dec 13, 2015
f7e7401
more conversions of pytest.raises to use 'with' instead.
pizzathief Dec 13, 2015
6f935ce
change nose method for calling test class methods.
pizzathief Dec 14, 2015
72ddc43
fixing pep8 failures.
pizzathief Dec 14, 2015
2d71f19
more pep8 fixes.
pizzathief Dec 14, 2015
571fbbd
another testing class that needed changes for pytest.
pizzathief Dec 14, 2015
50b0e0a
more pep8 failures to hide under the rug.
pizzathief Dec 14, 2015
4408d10
another pytest.raises to fix.
pizzathief Dec 14, 2015
4e87b72
lets try not comparing the equivilance of empty dicts, but rather
pizzathief Dec 14, 2015
6d3bb58
if commenting out the nose pep8 functions work, then they
pizzathief Dec 14, 2015
4bfbf26
pep8 fixes.
pizzathief Dec 14, 2015
1ffc9c2
fix typos found QuLogic
pizzathief Dec 14, 2015
389ebc3
removing (and moving) import code in tests.py
pizzathief Dec 15, 2015
1f1c2a6
replacing new nose calls with plain asserts
pizzathief Dec 15, 2015
01df455
exclude files from pep8 checking
pizzathief Dec 15, 2015
bb3ab51
add support for running a single test module, instead of all of them
pizzathief Dec 21, 2015
73e9383
The "_name.py" files in exclude_files might need globbing to
pizzathief Dec 28, 2015
5f3255b
pep8 failures
pizzathief Dec 28, 2015
f4826c3
pep8 was demanding that lambdas be replaced with proper functions.
pizzathief Dec 28, 2015
08ce37b
This is hopefully an acceptable solution to the problem with
pizzathief Dec 28, 2015
f705680
pep8 failures
pizzathief Dec 28, 2015
9aac515
remove assert_not_equal
pizzathief Dec 28, 2015
4a62ad9
lets try '--ignore'ing the numpy tests dir
pizzathief Dec 31, 2015
df2ebeb
Don't code at night on holidays with bad specs.
pizzathief Dec 31, 2015
1e12273
try norecursedirs to get pytest to stop looking in numpy
pizzathief Jan 1, 2016
47e0c4b
found cases of 'import nose' , and also, use of
pizzathief Jan 2, 2016
d04ab5c
needed to specify 'reason=' for xfail to work
pizzathief Jan 2, 2016
57b2f17
need to specify a 'reason=' to use pytest.maek.xfail
pizzathief Jan 2, 2016
636728f
don't need knownfailureif
pizzathief Jan 2, 2016
b0a342d
pytest xfail needs a 'reason'
pizzathief Jan 2, 2016
78587c1
fixing up small pytest issues
pizzathief Jan 2, 2016
09e559a
don't need the nose make_decorator function any more.
pizzathief Jan 4, 2016
8c3f2f1
to please the pep8 gods, we sacrifice this line break.
pizzathief Jan 4, 2016
62983b5
replace a knownfailureif call, and fix up pytest xfail calls
pizzathief Jan 4, 2016
e83807f
make_decorator seems to be described here.
pizzathief Jan 4, 2016
22ee978
resolve the oeo8 allergy to blank lines,
pizzathief Jan 4, 2016
ea7c57f
fix up xfail calls
pizzathief Jan 4, 2016
3008a22
another zfail reason fix
pizzathief Jan 4, 2016
49d2315
typo
pizzathief Jan 4, 2016
a1f31a8
don't import from nose , and don't need knownfailure
pizzathief Jan 5, 2016
e812aac
remove knownfailureif reference
pizzathief Jan 5, 2016
4fff146
An attempt to make a image_comparison decorator that doesn't fail
pizzathief Jan 8, 2016
738da3e
fix up indentation for import
pizzathief Jan 8, 2016
da60028
another fix for indentation. kinda non-dry'y
pizzathief Jan 8, 2016
726cc92
removed mentions of 'import nose'
pizzathief Jan 11, 2016
f17a2db
more nose lines to change
pizzathief Jan 11, 2016
683546e
regex assertions to convert
pizzathief Jan 11, 2016
63eae4b
replaced nose.assert_almost_equal with the numpy one, but
pizzathief Jan 11, 2016
6c46f42
basic nose replacement stuff
pizzathief Jan 11, 2016
c4a824e
fix up test failures caused through rebase
pizzathief Jan 14, 2016
ac14548
add in the ability to filter out numpy files from consideration
pizzathief Jan 15, 2016
3f45e42
fix up test_mlab.py raises and nose import lines
pizzathief Jan 17, 2016
38c29c6
fix test_apply_window_*D* function calls in test_mlab.py
pizzathief Jan 17, 2016
fc4e025
fix test_LogLocator in test_ticker.py
pizzathief Jan 17, 2016
ade1890
fix lack of pytest import in test_transforms.py
pizzathief Jan 17, 2016
1cbd24a
remove __name__ == '__main__' from many test files
pizzathief Jan 17, 2016
373fa15
PEP8 E301 in test_docstring_addition
pizzathief Jan 17, 2016
ca9828a
PEP8 E302 in test_transforms.py, test_transformed_path
pizzathief Jan 17, 2016
fa1e601
PEP8 E261 in test_mathtext.py, math_tests[]
pizzathief Jan 17, 2016
534ab6f
PEP8 E712 in test_figure.py, test_fignum_exists
pizzathief Jan 18, 2016
db2d85b
PEP8 E302 test_dviread.py around setup_PsfontsMap
pizzathief Jan 18, 2016
c4ea6d4
PEP8 E712 in test_axes.py
pizzathief Jan 18, 2016
a2291a1
PEP8 E712 in test_artist.py , test_remove
pizzathief Jan 18, 2016
65b42bd
PEP8 W293 in test_labeled_data_unpacking.py, test_docstring_addition
pizzathief Jan 18, 2016
8a22e2a
fix bad pytest raises calls in test_triangulation.py
pizzathief Jan 18, 2016
6ed71fa
fix bad pytest.raises calls in test_cbook.py test_step_fails
pizzathief Jan 18, 2016
f78c075
fix bad assert calls in test_pickle.py , test_transform
pizzathief Jan 18, 2016
1d7b37c
fix bad pytest.raises calls in test_colors.py, test_colors_no_float
pizzathief Jan 18, 2016
90bbe25
fix pytest.raises call in test_colors.py test_cmap_and_norm_from_leve…
pizzathief Jan 18, 2016
ee30e10
fix rebase omission, test_transform in test_pickle.py
pizzathief Jan 18, 2016
35520a4
fix user searh, not match in test_labeled_data_unpacking, test_docstr…
pizzathief Jan 18, 2016
b3c7dda
fix test_invalid_input_forms in test_cycles.py
pizzathief Jan 18, 2016
331428f
fix nose skiptest references, test_axes.py
pizzathief Jan 18, 2016
ea38ba6
remove nose import references, many files
pizzathief Jan 18, 2016
2cb6b8c
PEP8 E302 at test_gridspec.py
pizzathief Jan 18, 2016
accbcf2
doc convert nose docs to pytest, testing.rst
pizzathief Jan 19, 2016
a4ddff3
fix remove nose install from travis
pizzathief Jan 19, 2016
bd5828f
fix syntax error (newline) in testing.rst
pizzathief Jan 19, 2016
930c529
fix numpy pytest errors. don't put pylab in default namespace
pizzathief Jan 19, 2016
ae9715c
ENH: use pytest instead of nose.
pizzathief Oct 31, 2015
edabe74
pytest.raises(), not pytest.raise()
pizzathief Nov 4, 2015
23d6fae
pytest.raises() calls needed some massaging
pizzathief Nov 4, 2015
f27909a
fixing up problems with assert, and the use of messages.
pizzathief Nov 5, 2015
a023347
fix errors highlighted in travis CI logs
pizzathief Nov 5, 2015
dd8111b
fixing pytest failures. Interesting that assert can't seem to handle
pizzathief Nov 5, 2015
9f53f57
fixing syntax failures
pizzathief Nov 5, 2015
eefe67d
force pytest-pep8 to ignore the pep8 warnings that
pizzathief Nov 7, 2015
2661e32
the switches that nose needed , make pytest fail, so lets
pizzathief Nov 8, 2015
f404baa
another assert_raises to replace with pytest.raises
pizzathief Nov 13, 2015
53457e9
replaced a nose function for known failing tests
pizzathief Nov 13, 2015
0f9fae8
remove more of the nose infrastructure
pizzathief Nov 27, 2015
cd961cc
fix up a bunch of pytest.raises calls.
pizzathief Dec 13, 2015
de69032
converted assert_raises calls to pytest.raises.
pizzathief Dec 13, 2015
42185f8
fixing pep8 failures.
pizzathief Dec 14, 2015
cd81fbf
more pep8 failures to hide under the rug.
pizzathief Dec 14, 2015
523bb86
if commenting out the nose pep8 functions work, then they
pizzathief Dec 14, 2015
859f8d5
removing (and moving) import code in tests.py
pizzathief Dec 15, 2015
ad48b37
pep8 failures
pizzathief Dec 28, 2015
9a0b134
try norecursedirs to get pytest to stop looking in numpy
pizzathief Jan 1, 2016
23cee6a
found cases of 'import nose' , and also, use of
pizzathief Jan 2, 2016
c59a7b0
don't need the nose make_decorator function any more.
pizzathief Jan 4, 2016
43fd3e2
make_decorator seems to be described here.
pizzathief Jan 4, 2016
108522a
An attempt to make a image_comparison decorator that doesn't fail
pizzathief Jan 8, 2016
90221b9
fix up indentation for import
pizzathief Jan 8, 2016
6f74d88
another fix for indentation. kinda non-dry'y
pizzathief Jan 8, 2016
0ba7323
removed mentions of 'import nose'
pizzathief Jan 11, 2016
39612f6
fix up test failures caused through rebase
pizzathief Jan 14, 2016
336d1eb
remove __name__ == '__main__' from many test files
pizzathief Jan 17, 2016
7d9fdf6
fix test_invalid_input_forms in test_cycles.py
pizzathief Jan 18, 2016
606907b
fix nose skiptest references, test_axes.py
pizzathief Jan 18, 2016
db5f5e5
fix numpy pytest errors. don't put pylab in default namespace
pizzathief Jan 19, 2016
37418d8
PEP8 E502 at test_simplification.py, test_fft_peaks
pizzathief Jan 19, 2016
01b9215
remove @cleanup operator from test_complete. Its causing a pytest
pizzathief Jan 21, 2016
b9c0ee7
PEP8 E302 around teardown_PsfontsMap, test_dviread.py
pizzathief Jan 22, 2016
e002e48
fix lack of _func error in image_comparison_2, decorators.py
pizzathief Jan 22, 2016
25f77bc
fix assert_raises call in test_valid_linestyles, test_lines.py
pizzathief Jan 22, 2016
1996513
fix syntax error (another newline) in testing.rst, rst files
pizzathief Jan 22, 2016
07313db
doc lets remove pytest targets in rst for now
pizzathief Jan 22, 2016
280be1b
convert pytest.raises(error,f,x,y) calls to with pytest.raises
pizzathief Jan 23, 2016
a135e56
fix test_positional_parameter_names_as_function , seems getting a
pizzathief Jan 23, 2016
e52e0fc
PEP8 E201 in test_stride_windows_0D_ValueError, test_mlab.py
pizzathief Jan 23, 2016
d2f4e6b
as requested, push a simple change to test appveyor
pizzathief Feb 8, 2016
bf19dad
trying to get pytest to recognise dynamically created test
pizzathief Feb 10, 2016
f111193
make tests.py handle single modules better
pizzathief Feb 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more pep8 failures to hide under the rug.
  • Loading branch information
pizzathief committed Jan 21, 2016
commit 50b0e0af04721b64b27c09f2d82b42646cc604a8
137 changes: 82 additions & 55 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
# different baseline images to prevent race conditions when nose runs
# the tests with multiple threads.


@image_comparison(baseline_images=['formatter_ticker_001',
'formatter_ticker_002',
'formatter_ticker_003',
Expand Down Expand Up @@ -105,7 +106,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]))
Expand Down Expand Up @@ -139,7 +141,8 @@ def test_twinx_cla():
assert ax.yaxis.get_visible()


@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
Expand Down Expand Up @@ -322,26 +325,27 @@ 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)
y1.shape = 1, 10
Expand Down Expand Up @@ -428,7 +432,7 @@ def test_polar_units():
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) == True
units.UnitDblFormatter) == True


@image_comparison(baseline_images=['polar_rmin'])
Expand Down Expand Up @@ -524,7 +528,7 @@ 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()
Expand Down Expand Up @@ -592,7 +596,10 @@ 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:
Expand Down Expand Up @@ -620,7 +627,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)
Expand Down Expand Up @@ -679,17 +686,21 @@ 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)
# Test that plotting works for masked arrays with the first element masked
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'])
Expand Down Expand Up @@ -884,7 +895,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)
Expand Down Expand Up @@ -1111,20 +1123,23 @@ 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.05)

@image_comparison(baseline_images=['hist_steplog'], remove_text=True,
tol=0.05)
def test_hist_steplog():
np.random.seed(0)
data = np.random.standard_normal(2000)
Expand All @@ -1143,7 +1158,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_log_bottom'],
Expand Down Expand Up @@ -1316,7 +1332,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() == \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do asserts work with () line continuation?

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
Expand Down Expand Up @@ -1353,7 +1370,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)
Expand Down Expand Up @@ -1754,7 +1771,7 @@ def test_boxplot():
ax.set_ylim((-30, 30))

# Reuse testcase from above for a labeled data test
data={"x": [x, x]}
data = {"x": [x, x]}
fig, ax = plt.subplots()
ax.boxplot("x", bootstrap=10000, notch=1, data=data)
ax.set_ylim((-30, 30))
Expand Down Expand Up @@ -1795,13 +1812,15 @@ def test_boxplot_autorange_whiskers():
ax.boxplot([x, x], bootstrap=10000, notch=1)
ax.set_ylim((-5, 5))


def _rc_test_bxp_helper(ax, rc_dict):
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
with matplotlib.rc_context(rc_dict):
ax.boxplot([x, x])
return ax


@image_comparison(baseline_images=['boxplot_rc_parameters'],
savefig_kwarg={'dpi': 100}, remove_text=True, tol=1)
def test_boxplot_rc_parameters():
Expand Down Expand Up @@ -2181,7 +2200,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()
Expand Down Expand Up @@ -2285,7 +2303,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)
Expand Down Expand Up @@ -2376,7 +2395,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)
Expand All @@ -2399,7 +2419,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)


Expand Down Expand Up @@ -2436,6 +2457,7 @@ def test_rgba_markers():
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
Expand Down Expand Up @@ -2568,7 +2590,8 @@ def test_eventplot():
np.testing.assert_equal(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
Expand All @@ -2585,7 +2608,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
Expand Down Expand Up @@ -2623,14 +2647,16 @@ 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.keys(),
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)
for y, marker in enumerate(
sorted(matplotlib.markers.MarkerStyle.markers.keys(),
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)


@image_comparison(baseline_images=['rc_markerfill'], extensions=['png'])
Expand Down Expand Up @@ -3632,8 +3658,8 @@ def make_patch_spines_invisible(ax):
# 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.
# 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)
Expand Down Expand Up @@ -3813,7 +3839,7 @@ 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,
Expand Down Expand Up @@ -3899,10 +3925,11 @@ 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
# 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() )
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'],
Expand Down
Loading