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

Skip to content

Commit 920295d

Browse files
authored
Merge pull request #11204 from anntzer/boilerplate-test
TST: Test that boilerplate.py is correctly run.
2 parents d7bd340 + 0e8cd4a commit 920295d

File tree

2 files changed

+67
-18
lines changed

2 files changed

+67
-18
lines changed

lib/matplotlib/pyplot.py

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,8 +2259,12 @@ def axvspan(xmin, xmax, ymin=0, ymax=1, **kwargs):
22592259

22602260
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22612261
@docstring.copy_dedent(Axes.bar)
2262-
def bar(*args, data=None, **kwargs):
2263-
return gca().bar(*args, data=data, **kwargs)
2262+
def bar(
2263+
x, height, width=0.8, bottom=None, *, align='center',
2264+
data=None, **kwargs):
2265+
return gca().bar(
2266+
x=x, height=height, width=width, bottom=bottom, align=align,
2267+
data=data, **kwargs)
22642268

22652269
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22662270
@docstring.copy_dedent(Axes.barbs)
@@ -2269,8 +2273,10 @@ def barbs(*args, data=None, **kw):
22692273

22702274
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22712275
@docstring.copy_dedent(Axes.barh)
2272-
def barh(*args, **kwargs):
2273-
return gca().barh(*args, **kwargs)
2276+
def barh(y, width, height=0.8, left=None, *, align='center', **kwargs):
2277+
return gca().barh(
2278+
y=y, width=width, height=height, left=left, align=align,
2279+
**kwargs)
22742280

22752281
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22762282
@docstring.copy_dedent(Axes.boxplot)
@@ -2496,8 +2502,8 @@ def magnitude_spectrum(
24962502

24972503
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
24982504
@docstring.copy_dedent(Axes.margins)
2499-
def margins(*args, **kw):
2500-
return gca().margins(*args, **kw)
2505+
def margins(*margins, x=None, y=None, tight=True):
2506+
return gca().margins(*margins, x=x, y=y, tight=tight)
25012507

25022508
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25032509
@docstring.copy_dedent(Axes.minorticks_off)
@@ -2511,15 +2517,25 @@ def minorticks_on():
25112517

25122518
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25132519
@_autogen_docstring(Axes.pcolor)
2514-
def pcolor(*args, data=None, **kwargs):
2515-
__ret = gca().pcolor(*args, data=data, **kwargs)
2520+
def pcolor(
2521+
*args, alpha=None, norm=None, cmap=None, vmin=None,
2522+
vmax=None, data=None, **kwargs):
2523+
__ret = gca().pcolor(
2524+
*args, alpha=alpha, norm=norm, cmap=cmap, vmin=vmin,
2525+
vmax=vmax, data=data, **kwargs)
25162526
sci(__ret)
25172527
return __ret
25182528

25192529
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25202530
@_autogen_docstring(Axes.pcolormesh)
2521-
def pcolormesh(*args, data=None, **kwargs):
2522-
__ret = gca().pcolormesh(*args, data=data, **kwargs)
2531+
def pcolormesh(
2532+
*args, alpha=None, norm=None, cmap=None, vmin=None,
2533+
vmax=None, shading='flat', antialiased=False, data=None,
2534+
**kwargs):
2535+
__ret = gca().pcolormesh(
2536+
*args, alpha=alpha, norm=norm, cmap=cmap, vmin=vmin,
2537+
vmax=vmax, shading=shading, antialiased=antialiased,
2538+
data=data, **kwargs)
25232539
sci(__ret)
25242540
return __ret
25252541

@@ -2550,8 +2566,9 @@ def pie(
25502566

25512567
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25522568
@docstring.copy_dedent(Axes.plot)
2553-
def plot(*args, data=None, **kwargs):
2554-
return gca().plot(*args, data=data, **kwargs)
2569+
def plot(*args, scalex=True, scaley=True, data=None, **kwargs):
2570+
return gca().plot(
2571+
*args, scalex=scalex, scaley=scaley, data=data, **kwargs)
25552572

25562573
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25572574
@docstring.copy_dedent(Axes.plot_date)
@@ -2642,13 +2659,19 @@ def stackplot(x, *args, data=None, **kwargs):
26422659

26432660
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26442661
@docstring.copy_dedent(Axes.stem)
2645-
def stem(*args, data=None, **kwargs):
2646-
return gca().stem(*args, data=data, **kwargs)
2662+
def stem(
2663+
*args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
2664+
label=None, data=None):
2665+
return gca().stem(
2666+
*args, linefmt=linefmt, markerfmt=markerfmt, basefmt=basefmt,
2667+
bottom=bottom, label=label, data=data)
26472668

26482669
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26492670
@docstring.copy_dedent(Axes.step)
2650-
def step(x, y, *args, data=None, **kwargs):
2651-
return gca().step(x=x, y=y, *args, data=data, **kwargs)
2671+
def step(x, y, *args, where='pre', linestyle='', data=None, **kwargs):
2672+
return gca().step(
2673+
x=x, y=y, *args, where=where, linestyle=linestyle, data=data,
2674+
**kwargs)
26522675

26532676
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26542677
@_autogen_docstring(Axes.streamplot)
@@ -2685,8 +2708,13 @@ def tick_params(axis='both', **kwargs):
26852708

26862709
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26872710
@docstring.copy_dedent(Axes.ticklabel_format)
2688-
def ticklabel_format(**kwargs):
2689-
return gca().ticklabel_format(**kwargs)
2711+
def ticklabel_format(
2712+
*, axis='both', style='', scilimits=None, useOffset=None,
2713+
useLocale=None, useMathText=None):
2714+
return gca().ticklabel_format(
2715+
axis=axis, style=style, scilimits=scilimits,
2716+
useOffset=useOffset, useLocale=useLocale,
2717+
useMathText=useMathText)
26902718

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

lib/matplotlib/tests/test_pyplot.py

Lines changed: 21 additions & 0 deletions
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)