Skip to content

Commit

Permalink
Adds a small test for plotwrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Niru Maheswaranathan committed Nov 2, 2016
1 parent 07421d2 commit 25d8f2a
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_utils.py
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

0 comments on commit 25d8f2a

Please sign in to comment.