@@ -1113,3 +1113,27 @@ def test_qhull_large_offset():
11131113 triang = mtri .Triangulation (x , y )
11141114 triang_offset = mtri .Triangulation (x + offset , y + offset )
11151115 assert len (triang .triangles ) == len (triang_offset .triangles )
1116+
1117+
1118+ def test_tricontour_non_finite_z ():
1119+ # github issue 10167.
1120+ x = [0 , 1 , 0 , 1 ]
1121+ y = [0 , 0 , 1 , 1 ]
1122+ triang = mtri .Triangulation (x , y )
1123+ plt .figure ()
1124+
1125+ with pytest .raises (ValueError , match = 'z array must not contain non-finite '
1126+ 'values within the triangulation' ):
1127+ plt .tricontourf (triang , [0 , 1 , 2 , np .inf ])
1128+
1129+ with pytest .raises (ValueError , match = 'z array must not contain non-finite '
1130+ 'values within the triangulation' ):
1131+ plt .tricontourf (triang , [0 , 1 , 2 , - np .inf ])
1132+
1133+ with pytest .raises (ValueError , match = 'z array must not contain non-finite '
1134+ 'values within the triangulation' ):
1135+ plt .tricontourf (triang , [0 , 1 , 2 , np .nan ])
1136+
1137+ with pytest .raises (ValueError , match = 'z must not contain masked points '
1138+ 'within the triangulation' ):
1139+ plt .tricontourf (triang , np .ma .array ([0 , 1 , 2 , 3 ], mask = [1 , 0 , 0 , 0 ]))
0 commit comments