@@ -1033,74 +1033,82 @@ def test_internal_cpp_api():
10331033 # Following github issue 8197.
10341034
10351035 # C++ Triangulation.
1036- with pytest .raises (TypeError ) as excinfo :
1036+ with pytest .raises (
1037+ TypeError ,
1038+ match = r'function takes exactly 7 arguments \(0 given\)' ):
10371039 mpl ._tri .Triangulation ()
1038- excinfo .match (r'function takes exactly 7 arguments \(0 given\)' )
10391040
1040- with pytest .raises (ValueError ) as excinfo :
1041+ with pytest .raises (
1042+ ValueError , match = r'x and y must be 1D arrays of the same length' ):
10411043 mpl ._tri .Triangulation ([], [1 ], [[]], None , None , None , False )
1042- excinfo .match (r'x and y must be 1D arrays of the same length' )
10431044
10441045 x = [0 , 1 , 1 ]
10451046 y = [0 , 0 , 1 ]
1046- with pytest .raises (ValueError ) as excinfo :
1047+ with pytest .raises (
1048+ ValueError ,
1049+ match = r'triangles must be a 2D array of shape \(\?,3\)' ):
10471050 mpl ._tri .Triangulation (x , y , [[0 , 1 ]], None , None , None , False )
1048- excinfo .match (r'triangles must be a 2D array of shape \(\?,3\)' )
10491051
10501052 tris = [[0 , 1 , 2 ]]
1051- with pytest .raises (ValueError ) as excinfo :
1053+ with pytest .raises (
1054+ ValueError ,
1055+ match = r'mask must be a 1D array with the same length as the '
1056+ r'triangles array' ):
10521057 mpl ._tri .Triangulation (x , y , tris , [0 , 1 ], None , None , False )
1053- excinfo .match (r'mask must be a 1D array with the same length as the ' +
1054- r'triangles array' )
10551058
1056- with pytest .raises (ValueError ) as excinfo :
1059+ with pytest .raises (
1060+ ValueError , match = r'edges must be a 2D array with shape \(\?,2\)' ):
10571061 mpl ._tri .Triangulation (x , y , tris , None , [[1 ]], None , False )
1058- excinfo .match (r'edges must be a 2D array with shape \(\?,2\)' )
10591062
1060- with pytest .raises (ValueError ) as excinfo :
1063+ with pytest .raises (
1064+ ValueError ,
1065+ match = r'neighbors must be a 2D array with the same shape as the '
1066+ r'triangles array' ):
10611067 mpl ._tri .Triangulation (x , y , tris , None , None , [[- 1 ]], False )
1062- excinfo .match (r'neighbors must be a 2D array with the same shape as the ' +
1063- r'triangles array' )
10641068
10651069 triang = mpl ._tri .Triangulation (x , y , tris , None , None , None , False )
10661070
1067- with pytest .raises (ValueError ) as excinfo :
1071+ with pytest .raises (
1072+ ValueError ,
1073+ match = r'z array must have same length as triangulation x and y '
1074+ r'array' ):
10681075 triang .calculate_plane_coefficients ([])
1069- excinfo .match (r'z array must have same length as triangulation x and y ' +
1070- r'arrays' )
10711076
1072- with pytest .raises (ValueError ) as excinfo :
1077+ with pytest .raises (
1078+ ValueError ,
1079+ match = r'mask must be a 1D array with the same length as the '
1080+ r'triangles array' ):
10731081 triang .set_mask ([0 , 1 ])
1074- excinfo .match (r'mask must be a 1D array with the same length as the ' +
1075- r'triangles array' )
10761082
10771083 # C++ TriContourGenerator.
1078- with pytest .raises (TypeError ) as excinfo :
1079- tcg = mpl ._tri .TriContourGenerator ()
1080- excinfo .match (r'function takes exactly 2 arguments \(0 given\)' )
1084+ with pytest .raises (
1085+ TypeError ,
1086+ match = r'function takes exactly 2 arguments \(0 given\)' ):
1087+ mpl ._tri .TriContourGenerator ()
10811088
1082- with pytest .raises (ValueError ) as excinfo :
1083- tcg = mpl ._tri .TriContourGenerator (triang , [1 ])
1084- excinfo .match (r'z must be a 1D array with the same length as the x and ' +
1085- r'y arrays' )
1089+ with pytest .raises (
1090+ ValueError ,
1091+ match = r'z must be a 1D array with the same length as the x and y '
1092+ r'arrays' ):
1093+ mpl ._tri .TriContourGenerator (triang , [1 ])
10861094
10871095 z = [0 , 1 , 2 ]
10881096 tcg = mpl ._tri .TriContourGenerator (triang , z )
10891097
1090- with pytest .raises (ValueError ) as excinfo :
1098+ with pytest .raises (
1099+ ValueError , match = r'filled contour levels must be increasing' ):
10911100 tcg .create_filled_contour (1 , 0 )
1092- excinfo .match (r'filled contour levels must be increasing' )
10931101
10941102 # C++ TrapezoidMapTriFinder.
1095- with pytest .raises (TypeError ) as excinfo :
1096- trifinder = mpl . _tri . TrapezoidMapTriFinder ()
1097- excinfo . match ( r'function takes exactly 1 argument \(0 given\)' )
1103+ with pytest .raises (
1104+ TypeError , match = r'function takes exactly 1 argument \(0 given\)' ):
1105+ mpl . _tri . TrapezoidMapTriFinder ( )
10981106
10991107 trifinder = mpl ._tri .TrapezoidMapTriFinder (triang )
11001108
1101- with pytest .raises (ValueError ) as excinfo :
1109+ with pytest .raises (
1110+ ValueError , match = r'x and y must be array-like with same shape' ):
11021111 trifinder .find_many ([0 ], [0 , 1 ])
1103- excinfo .match (r'x and y must be array-like with same shape' )
11041112
11051113
11061114def test_qhull_large_offset ():
0 commit comments