Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/baccuslab/pyret
Browse files Browse the repository at this point in the history
  • Loading branch information
bnaecker committed Nov 2, 2016
2 parents 06b0590 + 25d8f2a commit 5a9264b
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 5a9264b

Please sign in to comment.