Skip to content

Commit 0e8cd4a

Browse files
committed
Test that boilerplate.py is correctly run.
(and update the outdated pyplot.py).
1 parent 1652ed1 commit 0e8cd4a

File tree

2 files changed

+67
-18
lines changed

2 files changed

+67
-18
lines changed

lib/matplotlib/pyplot.py

+46-18
Original file line numberDiff line numberDiff line change
@@ -2269,8 +2269,12 @@ def axvspan(xmin, xmax, ymin=0, ymax=1, **kwargs):
22692269

22702270
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22712271
@docstring.copy_dedent(Axes.bar)
2272-
def bar(*args, data=None, **kwargs):
2273-
return gca().bar(*args, data=data, **kwargs)
2272+
def bar(
2273+
x, height, width=0.8, bottom=None, *, align='center',
2274+
data=None, **kwargs):
2275+
return gca().bar(
2276+
x=x, height=height, width=width, bottom=bottom, align=align,
2277+
data=data, **kwargs)
22742278

22752279
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22762280
@docstring.copy_dedent(Axes.barbs)
@@ -2279,8 +2283,10 @@ def barbs(*args, data=None, **kw):
22792283

22802284
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22812285
@docstring.copy_dedent(Axes.barh)
2282-
def barh(*args, **kwargs):
2283-
return gca().barh(*args, **kwargs)
2286+
def barh(y, width, height=0.8, left=None, *, align='center', **kwargs):
2287+
return gca().barh(
2288+
y=y, width=width, height=height, left=left, align=align,
2289+
**kwargs)
22842290

22852291
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22862292
@docstring.copy_dedent(Axes.boxplot)
@@ -2506,8 +2512,8 @@ def magnitude_spectrum(
25062512

25072513
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25082514
@docstring.copy_dedent(Axes.margins)
2509-
def margins(*args, **kw):
2510-
return gca().margins(*args, **kw)
2515+
def margins(*margins, x=None, y=None, tight=True):
2516+
return gca().margins(*margins, x=x, y=y, tight=tight)
25112517

25122518
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25132519
@docstring.copy_dedent(Axes.minorticks_off)
@@ -2521,15 +2527,25 @@ def minorticks_on():
25212527

25222528
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25232529
@_autogen_docstring(Axes.pcolor)
2524-
def pcolor(*args, data=None, **kwargs):
2525-
__ret = gca().pcolor(*args, data=data, **kwargs)
2530+
def pcolor(
2531+
*args, alpha=None, norm=None, cmap=None, vmin=None,
2532+
vmax=None, data=None, **kwargs):
2533+
__ret = gca().pcolor(
2534+
*args, alpha=alpha, norm=norm, cmap=cmap, vmin=vmin,
2535+
vmax=vmax, data=data, **kwargs)
25262536
sci(__ret)
25272537
return __ret
25282538

25292539
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25302540
@_autogen_docstring(Axes.pcolormesh)
2531-
def pcolormesh(*args, data=None, **kwargs):
2532-
__ret = gca().pcolormesh(*args, data=data, **kwargs)
2541+
def pcolormesh(
2542+
*args, alpha=None, norm=None, cmap=None, vmin=None,
2543+
vmax=None, shading='flat', antialiased=False, data=None,
2544+
**kwargs):
2545+
__ret = gca().pcolormesh(
2546+
*args, alpha=alpha, norm=norm, cmap=cmap, vmin=vmin,
2547+
vmax=vmax, shading=shading, antialiased=antialiased,
2548+
data=data, **kwargs)
25332549
sci(__ret)
25342550
return __ret
25352551

@@ -2560,8 +2576,9 @@ def pie(
25602576

25612577
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25622578
@docstring.copy_dedent(Axes.plot)
2563-
def plot(*args, data=None, **kwargs):
2564-
return gca().plot(*args, data=data, **kwargs)
2579+
def plot(*args, scalex=True, scaley=True, data=None, **kwargs):
2580+
return gca().plot(
2581+
*args, scalex=scalex, scaley=scaley, data=data, **kwargs)
25652582

25662583
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25672584
@docstring.copy_dedent(Axes.plot_date)
@@ -2652,13 +2669,19 @@ def stackplot(x, *args, data=None, **kwargs):
26522669

26532670
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26542671
@docstring.copy_dedent(Axes.stem)
2655-
def stem(*args, data=None, **kwargs):
2656-
return gca().stem(*args, data=data, **kwargs)
2672+
def stem(
2673+
*args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
2674+
label=None, data=None):
2675+
return gca().stem(
2676+
*args, linefmt=linefmt, markerfmt=markerfmt, basefmt=basefmt,
2677+
bottom=bottom, label=label, data=data)
26572678

26582679
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26592680
@docstring.copy_dedent(Axes.step)
2660-
def step(x, y, *args, data=None, **kwargs):
2661-
return gca().step(x=x, y=y, *args, data=data, **kwargs)
2681+
def step(x, y, *args, where='pre', linestyle='', data=None, **kwargs):
2682+
return gca().step(
2683+
x=x, y=y, *args, where=where, linestyle=linestyle, data=data,
2684+
**kwargs)
26622685

26632686
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26642687
@_autogen_docstring(Axes.streamplot)
@@ -2695,8 +2718,13 @@ def tick_params(axis='both', **kwargs):
26952718

26962719
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26972720
@docstring.copy_dedent(Axes.ticklabel_format)
2698-
def ticklabel_format(**kwargs):
2699-
return gca().ticklabel_format(**kwargs)
2721+
def ticklabel_format(
2722+
*, axis='both', style='', scilimits=None, useOffset=None,
2723+
useLocale=None, useMathText=None):
2724+
return gca().ticklabel_format(
2725+
axis=axis, style=style, scilimits=scilimits,
2726+
useOffset=useOffset, useLocale=useLocale,
2727+
useMathText=useMathText)
27002728

27012729
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
27022730
@_autogen_docstring(Axes.tricontour)

lib/matplotlib/tests/test_pyplot.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import subprocess
2+
import sys
3+
from pathlib import Path
4+
5+
import pytest
6+
7+
import matplotlib as mpl
8+
from matplotlib import pyplot as plt
9+
10+
11+
def test_pyplot_up_to_date():
12+
gen_script = Path(mpl.__file__).parents[2] / "tools/boilerplate.py"
13+
if not gen_script.exists():
14+
pytest.skip("boilerplate.py not found")
15+
orig_contents = Path(plt.__file__).read_text()
16+
try:
17+
subprocess.run([sys.executable, str(gen_script)], check=True)
18+
new_contents = Path(plt.__file__).read_text()
19+
assert orig_contents == new_contents
20+
finally:
21+
Path(plt.__file__).write_text(orig_contents)

0 commit comments

Comments
 (0)