From 0e8cd4a192bbc0212132cfe929abd82d0de5bd0f Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 8 May 2018 22:49:18 -0700 Subject: [PATCH] Test that boilerplate.py is correctly run. (and update the outdated pyplot.py). --- lib/matplotlib/pyplot.py | 64 +++++++++++++++++++++-------- lib/matplotlib/tests/test_pyplot.py | 21 ++++++++++ 2 files changed, 67 insertions(+), 18 deletions(-) create mode 100644 lib/matplotlib/tests/test_pyplot.py diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index b06801ce7cbd..258d13cb4f40 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -2269,8 +2269,12 @@ def axvspan(xmin, xmax, ymin=0, ymax=1, **kwargs): # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.bar) -def bar(*args, data=None, **kwargs): - return gca().bar(*args, data=data, **kwargs) +def bar( + x, height, width=0.8, bottom=None, *, align='center', + data=None, **kwargs): + return gca().bar( + x=x, height=height, width=width, bottom=bottom, align=align, + data=data, **kwargs) # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.barbs) @@ -2279,8 +2283,10 @@ def barbs(*args, data=None, **kw): # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.barh) -def barh(*args, **kwargs): - return gca().barh(*args, **kwargs) +def barh(y, width, height=0.8, left=None, *, align='center', **kwargs): + return gca().barh( + y=y, width=width, height=height, left=left, align=align, + **kwargs) # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.boxplot) @@ -2506,8 +2512,8 @@ def magnitude_spectrum( # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.margins) -def margins(*args, **kw): - return gca().margins(*args, **kw) +def margins(*margins, x=None, y=None, tight=True): + return gca().margins(*margins, x=x, y=y, tight=tight) # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.minorticks_off) @@ -2521,15 +2527,25 @@ def minorticks_on(): # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @_autogen_docstring(Axes.pcolor) -def pcolor(*args, data=None, **kwargs): - __ret = gca().pcolor(*args, data=data, **kwargs) +def pcolor( + *args, alpha=None, norm=None, cmap=None, vmin=None, + vmax=None, data=None, **kwargs): + __ret = gca().pcolor( + *args, alpha=alpha, norm=norm, cmap=cmap, vmin=vmin, + vmax=vmax, data=data, **kwargs) sci(__ret) return __ret # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @_autogen_docstring(Axes.pcolormesh) -def pcolormesh(*args, data=None, **kwargs): - __ret = gca().pcolormesh(*args, data=data, **kwargs) +def pcolormesh( + *args, alpha=None, norm=None, cmap=None, vmin=None, + vmax=None, shading='flat', antialiased=False, data=None, + **kwargs): + __ret = gca().pcolormesh( + *args, alpha=alpha, norm=norm, cmap=cmap, vmin=vmin, + vmax=vmax, shading=shading, antialiased=antialiased, + data=data, **kwargs) sci(__ret) return __ret @@ -2560,8 +2576,9 @@ def pie( # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.plot) -def plot(*args, data=None, **kwargs): - return gca().plot(*args, data=data, **kwargs) +def plot(*args, scalex=True, scaley=True, data=None, **kwargs): + return gca().plot( + *args, scalex=scalex, scaley=scaley, data=data, **kwargs) # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.plot_date) @@ -2652,13 +2669,19 @@ def stackplot(x, *args, data=None, **kwargs): # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.stem) -def stem(*args, data=None, **kwargs): - return gca().stem(*args, data=data, **kwargs) +def stem( + *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0, + label=None, data=None): + return gca().stem( + *args, linefmt=linefmt, markerfmt=markerfmt, basefmt=basefmt, + bottom=bottom, label=label, data=data) # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.step) -def step(x, y, *args, data=None, **kwargs): - return gca().step(x=x, y=y, *args, data=data, **kwargs) +def step(x, y, *args, where='pre', linestyle='', data=None, **kwargs): + return gca().step( + x=x, y=y, *args, where=where, linestyle=linestyle, data=data, + **kwargs) # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @_autogen_docstring(Axes.streamplot) @@ -2695,8 +2718,13 @@ def tick_params(axis='both', **kwargs): # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy_dedent(Axes.ticklabel_format) -def ticklabel_format(**kwargs): - return gca().ticklabel_format(**kwargs) +def ticklabel_format( + *, axis='both', style='', scilimits=None, useOffset=None, + useLocale=None, useMathText=None): + return gca().ticklabel_format( + axis=axis, style=style, scilimits=scilimits, + useOffset=useOffset, useLocale=useLocale, + useMathText=useMathText) # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @_autogen_docstring(Axes.tricontour) diff --git a/lib/matplotlib/tests/test_pyplot.py b/lib/matplotlib/tests/test_pyplot.py new file mode 100644 index 000000000000..e939d440060b --- /dev/null +++ b/lib/matplotlib/tests/test_pyplot.py @@ -0,0 +1,21 @@ +import subprocess +import sys +from pathlib import Path + +import pytest + +import matplotlib as mpl +from matplotlib import pyplot as plt + + +def test_pyplot_up_to_date(): + gen_script = Path(mpl.__file__).parents[2] / "tools/boilerplate.py" + if not gen_script.exists(): + pytest.skip("boilerplate.py not found") + orig_contents = Path(plt.__file__).read_text() + try: + subprocess.run([sys.executable, str(gen_script)], check=True) + new_contents = Path(plt.__file__).read_text() + assert orig_contents == new_contents + finally: + Path(plt.__file__).write_text(orig_contents) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy