-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Niru Maheswaranathan
committed
Nov 2, 2016
1 parent
07421d2
commit 25d8f2a
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import matplotlib | ||
import matplotlib.pyplot as plt | ||
from pyret.utils import plotwrapper | ||
|
||
|
||
def test_plotwrapper(): | ||
|
||
def dummy(**kwargs): | ||
pass | ||
|
||
f = plotwrapper(dummy) | ||
|
||
plt.close('all') | ||
fig, ax = f() | ||
assert type(fig) is matplotlib.figure.Figure | ||
assert issubclass(type(ax), matplotlib.axes.Axes) | ||
|
||
plt.close('all') | ||
fig, ax = f(fig=plt.gcf()) | ||
assert fig is plt.gcf() | ||
assert issubclass(type(ax), matplotlib.axes.Axes) | ||
|
||
plt.close('all') | ||
fig, ax = f(fig=plt.gcf(), ax=plt.gca()) | ||
assert fig is plt.gcf() | ||
assert ax is plt.gca() | ||
|
||
plt.close('all') | ||
_fig = plt.figure() | ||
_ax = _fig.add_subplot(111) | ||
fig, ax = f(ax=_ax) | ||
assert fig is _fig | ||
assert ax is _ax |