Skip to content

Commit f7e1e58

Browse files
Add test to test stop_viewing...
1 parent 66e0213 commit f7e1e58

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

matplotview/_docs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import inspect
2-
from inspect import signature
32

43

54
def dynamic_doc_string(**kwargs):
65
def convert(func):
76
default_vals = {
8-
k: v.default for k, v in signature(func).parameters.items()
7+
k: v.default for k, v in inspect.signature(func).parameters.items()
98
if(v.default is not inspect.Parameter.empty)
109
}
1110
default_vals.update(kwargs)

matplotview/tests/test_view_rendering.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import matplotlib.pyplot as plt
33
from matplotlib.testing.decorators import check_figures_equal
4-
from matplotview import view, inset_zoom_axes
4+
from matplotview import view, inset_zoom_axes, stop_viewing
55

66

77
@check_figures_equal(tol=6)
@@ -219,3 +219,24 @@ def test_double_view(fig_test, fig_ref):
219219
ax.set_aspect(1)
220220
ax.relim()
221221
ax.autoscale_view()
222+
223+
224+
@check_figures_equal()
225+
def test_stop_viewing(fig_test, fig_ref):
226+
np.random.seed(1)
227+
data = np.random.randint(0, 10, 10)
228+
229+
# Test case... Create a view and stop it...
230+
ax1_test, ax2_test = fig_test.subplots(1, 2)
231+
232+
ax1_test.plot(data)
233+
ax1_test.text(0.5, 0.5, "Hello")
234+
235+
view(ax2_test, ax1_test)
236+
stop_viewing(ax2_test, ax1_test)
237+
238+
# Reference, just don't plot anything at all in the second axes...
239+
ax1_ref, ax2_ref = fig_ref.subplots(1, 2)
240+
241+
ax1_ref.plot(data)
242+
ax1_ref.text(0.5, 0.5, "Hello")

0 commit comments

Comments
 (0)