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

Skip to content

Commit d660e49

Browse files
author
Vedant Nanda
committed
Updated tests to work with py3k
1 parent b4fa6d1 commit d660e49

File tree

2 files changed

+20
-42
lines changed

2 files changed

+20
-42
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4975,29 +4975,20 @@ def test_bar_single_height():
49754975

49764976

49774977
def test_invalid_axes_limits():
4978-
error_string = 'NaN or Inf cannot be the argument values'
4979-
with pytest.raises(ValueError) as err:
4978+
with pytest.raises(ValueError):
49804979
plt.xlim(left=np.nan)
4981-
assert err.value.message == error_string
4982-
with pytest.raises(ValueError) as err:
4980+
with pytest.raises(ValueError):
49834981
plt.xlim(left=np.inf)
4984-
assert err.value.message == error_string
4985-
with pytest.raises(ValueError) as err:
4982+
with pytest.raises(ValueError):
49864983
plt.xlim(right=np.nan)
4987-
assert err.value.message == error_string
4988-
with pytest.raises(ValueError) as err:
4984+
with pytest.raises(ValueError):
49894985
plt.xlim(right=np.inf)
4990-
assert err.value.message == error_string
49914986

4992-
with pytest.raises(ValueError) as err:
4987+
with pytest.raises(ValueError):
49934988
plt.ylim(bottom=np.nan)
4994-
assert err.value.message == error_string
4995-
with pytest.raises(ValueError) as err:
4989+
with pytest.raises(ValueError):
49964990
plt.ylim(bottom=np.inf)
4997-
assert err.value.message == error_string
4998-
with pytest.raises(ValueError) as err:
4991+
with pytest.raises(ValueError):
49994992
plt.ylim(top=np.nan)
5000-
assert err.value.message == error_string
5001-
with pytest.raises(ValueError) as err:
4993+
with pytest.raises(ValueError):
50024994
plt.ylim(top=np.inf)
5003-
assert err.value.message == error_string

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -494,44 +494,31 @@ def test_autoscale():
494494

495495

496496
def test_invalid_axes_limits():
497-
error_string = 'NaN or Inf cannot be the argument values'
498497
fig = plt.figure()
499498
ax = fig.add_subplot(111, projection='3d')
500-
with pytest.raises(ValueError) as err:
499+
with pytest.raises(ValueError):
501500
ax.set_xlim3d(left=np.nan)
502-
assert err.value.message == error_string
503-
with pytest.raises(ValueError) as err:
501+
with pytest.raises(ValueError):
504502
ax.set_xlim3d(left=np.inf)
505-
assert err.value.message == error_string
506-
with pytest.raises(ValueError) as err:
503+
with pytest.raises(ValueError):
507504
ax.set_xlim3d(right=np.nan)
508-
assert err.value.message == error_string
509-
with pytest.raises(ValueError) as err:
505+
with pytest.raises(ValueError):
510506
ax.set_xlim3d(right=np.inf)
511-
assert err.value.message == error_string
512507

513-
with pytest.raises(ValueError) as err:
508+
with pytest.raises(ValueError):
514509
ax.set_ylim3d(bottom=np.nan)
515-
assert err.value.message == error_string
516-
with pytest.raises(ValueError) as err:
510+
with pytest.raises(ValueError):
517511
ax.set_ylim3d(bottom=np.inf)
518-
assert err.value.message == error_string
519-
with pytest.raises(ValueError) as err:
512+
with pytest.raises(ValueError):
520513
ax.set_ylim3d(top=np.nan)
521-
assert err.value.message == error_string
522-
with pytest.raises(ValueError) as err:
514+
with pytest.raises(ValueError):
523515
ax.set_ylim3d(top=np.inf)
524-
assert err.value.message == error_string
525516

526-
with pytest.raises(ValueError) as err:
517+
with pytest.raises(ValueError):
527518
ax.set_zlim3d(bottom=np.nan)
528-
assert err.value.message == error_string
529-
with pytest.raises(ValueError) as err:
519+
with pytest.raises(ValueError):
530520
ax.set_zlim3d(bottom=np.inf)
531-
assert err.value.message == error_string
532-
with pytest.raises(ValueError) as err:
521+
with pytest.raises(ValueError):
533522
ax.set_zlim3d(top=np.nan)
534-
assert err.value.message == error_string
535-
with pytest.raises(ValueError) as err:
523+
with pytest.raises(ValueError):
536524
ax.set_zlim3d(top=np.inf)
537-
assert err.value.message == error_string

0 commit comments

Comments
 (0)