Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 347527d

Browse files
committed
Replace list(xrange()) with np.arange in transform tests.
1 parent 246ab0e commit 347527d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/matplotlib/tests/test_transforms.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
unicode_literals)
33

44
import six
5-
from six.moves import xrange, zip
5+
from six.moves import zip
66

77
import unittest
88

@@ -49,7 +49,7 @@ def transform_non_affine(self, path):
4949

5050
my_trans = AssertingNonAffineTransform()
5151
ax = plt.axes()
52-
plt.plot(list(xrange(10)), transform=my_trans + ax.transData)
52+
plt.plot(np.arange(10), transform=my_trans + ax.transData)
5353
plt.draw()
5454
# enable the transform to raise an exception if it's non-affine transform
5555
# method is triggered again.
@@ -68,7 +68,7 @@ def _as_mpl_transform(self, axes):
6868
return mtrans.Affine2D().scale(self._scale_factor) + axes.transData
6969

7070
ax = plt.axes()
71-
line, = plt.plot(list(xrange(10)), transform=ScaledBy(10))
71+
line, = plt.plot(np.arange(10), transform=ScaledBy(10))
7272
ax.set_xlim(0, 100)
7373
ax.set_ylim(0, 100)
7474
# assert that the top transform of the line is the scale transform.
@@ -415,15 +415,15 @@ def test_line_extent_compound_coords2(self):
415415
def test_line_extents_affine(self):
416416
ax = plt.axes()
417417
offset = mtrans.Affine2D().translate(10, 10)
418-
plt.plot(list(xrange(10)), transform=offset + ax.transData)
418+
plt.plot(np.arange(10), transform=offset + ax.transData)
419419
expected_data_lim = np.array([[0., 0.], [9., 9.]]) + 10
420420
assert_array_almost_equal(ax.dataLim.get_points(), expected_data_lim)
421421

422422
def test_line_extents_non_affine(self):
423423
ax = plt.axes()
424424
offset = mtrans.Affine2D().translate(10, 10)
425425
na_offset = NonAffineForTest(mtrans.Affine2D().translate(10, 10))
426-
plt.plot(list(xrange(10)), transform=offset + na_offset + ax.transData)
426+
plt.plot(np.arange(10), transform=offset + na_offset + ax.transData)
427427
expected_data_lim = np.array([[0., 0.], [9., 9.]]) + 20
428428
assert_array_almost_equal(ax.dataLim.get_points(), expected_data_lim)
429429

@@ -452,7 +452,7 @@ def test_line_extents_for_non_affine_transData(self):
452452
# add 10 to the radius of the data
453453
offset = mtrans.Affine2D().translate(0, 10)
454454

455-
plt.plot(list(xrange(10)), transform=offset + ax.transData)
455+
plt.plot(np.arange(10), transform=offset + ax.transData)
456456
# the data lim of a polar plot is stored in coordinates
457457
# before a transData transformation, hence the data limits
458458
# are not what is being shown on the actual plot.

0 commit comments

Comments
 (0)