Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a660aa6

Browse filesBrowse files
committed
Improved syntax of exception handling in tests
1 parent 88ee7bf commit a660aa6
Copy full SHA for a660aa6

File tree

Expand file treeCollapse file tree

1 file changed

+7
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-8
lines changed

‎lib/matplotlib/tests/test_triangulation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_triangulation.py
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,18 +1124,17 @@ def test_tricontour_non_finite_z():
11241124
triang = mtri.Triangulation(x, y)
11251125
plt.figure()
11261126

1127-
with pytest.raises(ValueError) as excinfo:
1127+
with pytest.raises(ValueError, match='z array cannot contain non-finite ' +
1128+
'values'):
11281129
plt.tricontourf(triang, [0, 1, 2, np.inf])
1129-
excinfo.match(r'z array cannot contain non-finite values')
11301130

1131-
with pytest.raises(ValueError) as excinfo:
1131+
with pytest.raises(ValueError, match='z array cannot contain non-finite ' +
1132+
'values'):
11321133
plt.tricontourf(triang, [0, 1, 2, -np.inf])
1133-
excinfo.match(r'z array cannot contain non-finite values')
11341134

1135-
with pytest.raises(ValueError) as excinfo:
1135+
with pytest.raises(ValueError, match='z array cannot contain non-finite ' +
1136+
'values'):
11361137
plt.tricontourf(triang, [0, 1, 2, np.nan])
1137-
excinfo.match(r'z array cannot contain non-finite values')
11381138

1139-
with pytest.raises(ValueError) as excinfo:
1139+
with pytest.raises(ValueError, match='z cannot be a masked array'):
11401140
plt.tricontourf(triang, np.ma.array([0, 1, 2, 3], mask=[1, 0, 0, 0]))
1141-
excinfo.match(r'z cannot be a masked array')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.