8000 Merge pull request #1162 from NelleV/FIX_tests · matplotlib/matplotlib@3649d2b · GitHub
[go: up one dir, main page]

Skip to content

Commit 3649d2b

Browse files
committed
Merge pull request #1162 from NelleV/FIX_tests
fix use of nose.tools.assert_is which is not supported in python2.6
2 parents 7a61238 + 7eeeead commit 3649d2b

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

lib/matplotlib/tests/test_figure.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
from nose.tools import assert_equal, assert_is, assert_is_not
1+
from nose.tools import assert_equal, assert_true
22
from matplotlib.testing.decorators import image_comparison, cleanup
33
import matplotlib.pyplot as plt
44

55

66
@cleanup
77
def test_figure_label():
8-
# pyplot figure creation, selection and closing with figure label and number
8+
# pyplot figure creation, selection and closing with figure label and
9+
# number
910
plt.close('all')
1011
plt.figure('today')
1112
plt.figure(3)
@@ -33,34 +34,37 @@ def test_figure():
3334
ax.plot(range(5))
3435
# plot red line in a different figure.
3536
plt.figure('tomorrow')
36-
plt.plot([0, 1], [1,0], 'r')
37+
plt.plot([0, 1], [1, 0], 'r')
3738
# Return to the original; make sure the red line is not there.
3839
plt.figure('today')
3940
plt.close('tomorrow')
40-
41-
41+
42+
4243
@cleanup
4344
def test_gca():
4445
fig = plt.figure()
4546

4647
ax1 = fig.add_axes([0, 0, 1, 1])
47-
assert_is(fig.gca(projection='rectilinear'), ax1)
48-
assert_is(fig.gca(), ax1)
49-
48+
assert_true(fig.gca(projection='rectilinear') is ax1)
49+
assert_true(fig.gca() is ax1)
50+
5051
ax2 = fig.add_subplot(121, projection='polar')
51-
assert_is(fig.gca(), ax2)
52-
assert_is(fig.gca(polar=True), ax2)
53-
52+
assert_true(fig.gca() is ax2)
53+
assert_true(fig.gca(polar=True)is ax2)
54+
5455
ax3 = fig.add_subplot(122)
55-
assert_is(fig.gca(), ax3)
56+
assert_true(fig.gca() is ax3)
5657

5758
# the final request for a polar axes will end up creating one
5859
# with a spec of 111.
59-
assert_is_not(fig.gca(polar=True), ax3)
60-
assert_is_not(fig.gca(polar=True), ax2)
60+
assert_true(fig.gca(polar=True) is not ax3)
61+
assert_true(fig.gca(polar=True) is not ax2)
6162
assert_equal(fig.gca().get_geometry(), (1, 1, 1))
62-
63+
6364
fig.sca(ax1)
64-
assert_is(fig.gca(projection='rectilinear'), ax1)
65-
assert_is(fig.gca(), ax1)
66-
65+
assert_true(fig.gca(projection='rectilinear') is ax1)
66+
assert_true(fig.gca() is ax1)
67+
68+
if __name__ == "__main__":
69+
import nose
70+
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)
0