@@ -1033,74 +1033,82 @@ def test_internal_cpp_api():
1033
1033
# Following github issue 8197.
1034
1034
1035
1035
# 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\)' ):
1037
1039
mpl ._tri .Triangulation ()
1038
- excinfo .match (r'function takes exactly 7 arguments \(0 given\)' )
1039
1040
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' ):
1041
1043
mpl ._tri .Triangulation ([], [1 ], [[]], None , None , None , False )
1042
- excinfo .match (r'x and y must be 1D arrays of the same length' )
1043
1044
1044
1045
x = [0 , 1 , 1 ]
1045
1046
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\)' ):
1047
1050
mpl ._tri .Triangulation (x , y , [[0 , 1 ]], None , None , None , False )
1048
- excinfo .match (r'triangles must be a 2D array of shape \(\?,3\)' )
1049
1051
1050
1052
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' ):
1052
1057
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' )
1055
1058
1056
- with pytest .raises (ValueError ) as excinfo :
1059
+ with pytest .raises (
1060
+ ValueError , match = r'edges must be a 2D array with shape \(\?,2\)' ):
1057
1061
mpl ._tri .Triangulation (x , y , tris , None , [[1 ]], None , False )
1058
- excinfo .match (r'edges must be a 2D array with shape \(\?,2\)' )
1059
1062
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' ):
1061
1067
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' )
1064
1068
1065
1069
triang = mpl ._tri .Triangulation (x , y , tris , None , None , None , False )
1066
1070
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' ):
1068
1075
triang .calculate_plane_coefficients ([])
1069
- excinfo .match (r'z array must have same length as triangulation x and y ' +
1070
- r'arrays' )
1071
1076
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' ):
1073
1081
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' )
1076
1082
1077
1083
# 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 ()
1081
1088
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 ])
1086
1094
1087
1095
z = [0 , 1 , 2 ]
1088
1096
tcg = mpl ._tri .TriContourGenerator (triang , z )
1089
1097
1090
- with pytest .raises (ValueError ) as excinfo :
1098
+ with pytest .raises (
1099
+ ValueError , match = r'filled contour levels must be increasing' ):
1091
1100
tcg .create_filled_contour (1 , 0 )
1092
- excinfo .match (r'filled contour levels must be increasing' )
1093
1101
1094
1102
# 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 ( )
1098
1106
1099
1107
trifinder = mpl ._tri .TrapezoidMapTriFinder (triang )
1100
1108
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' ):
1102
1111
trifinder .find_many ([0 ], [0 , 1 ])
1103
- excinfo .match (r'x and y must be array-like with same shape' )
1104
1112
1105
1113
1106
1114
def test_qhull_large_offset ():
0 commit comments