Skip to content

Commit 6b2445d

Browse files
simonjayhawkinsjreback
authored andcommitted
CLN: Remove type from (class|type) in regexes (#26434)
1 parent 1263e1a commit 6b2445d

File tree

6 files changed

+7
-11
lines changed

6 files changed

+7
-11
lines changed

pandas/tests/indexes/interval/test_construction.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ def test_constructor_errors(self, constructor):
331331
constructor(5)
332332

333333
# not an interval
334-
msg = ("type <(class|type) 'numpy.int64'> with value 0 "
335-
"is not an interval")
334+
msg = "type <class 'numpy.int64'> with value 0 is not an interval"
336335
with pytest.raises(TypeError, match=msg):
337336
constructor([0, 1])
338337

pandas/tests/io/test_packers.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ class A:
153153
def __init__(self):
154154
self.read = 0
155155

156-
msg = (r"Invalid file path or buffer object type: <(class|type)"
157-
r" '{}'>")
156+
msg = "Invalid file path or buffer object type: <class '{}'>"
158157
with pytest.raises(ValueError, match=msg.format('NoneType')):
159158
read_msgpack(path_or_buf=None)
160159
with pytest.raises(ValueError, match=msg.format('dict')):

pandas/tests/reshape/merge/test_merge.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,11 @@ def test_merge_misspecified(self):
182182
right_on=['key1', 'key2'])
183183

184184
def test_index_and_on_parameters_confusion(self):
185-
msg = ("right_index parameter must be of type bool, not"
186-
r" <(class|type) 'list'>")
185+
msg = "right_index parameter must be of type bool, not <class 'list'>"
187186
with pytest.raises(ValueError, match=msg):
188187
merge(self.df, self.df2, how='left',
189188
left_index=False, right_index=['key1', 'key2'])
190-
msg = ("left_index parameter must be of type bool, not "
191-
r"<(class|type) 'list'>")
189+
msg = "left_index parameter must be of type bool, not <class 'list'>"
192190
with pytest.raises(ValueError, match=msg):
193191
merge(self.df, self.df2, how='left',
194192
left_index=['key1', 'key2'], right_index=False)

pandas/tests/series/indexing/test_numeric.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def test_setitem_float_labels():
204204
def test_slice_float_get_set(test_data):
205205
msg = (r"cannot do slice indexing on <class 'pandas\.core\.indexes"
206206
r"\.datetimes\.DatetimeIndex'> with these indexers \[{key}\]"
207-
r" of <(class|type) 'float'>")
207+
r" of <class 'float'>")
208208
with pytest.raises(TypeError, match=msg.format(key=r"4\.0")):
209209
test_data.ts[4.0:10.0]
210210

pandas/tests/series/test_analytics.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_argsort_stable(self):
9191
check_dtype=False)
9292
tm.assert_series_equal(qindexer, Series(qexpected),
9393
check_dtype=False)
94-
msg = (r"ndarray Expected type <(class|type) 'numpy\.ndarray'>,"
94+
msg = (r"ndarray Expected type <class 'numpy\.ndarray'>,"
9595
r" found <class 'pandas\.core\.series\.Series'> instead")
9696
with pytest.raises(AssertionError, match=msg):
9797
tm.assert_numpy_array_equal(qindexer, mindexer)

pandas/tests/tslibs/test_timedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ def test_delta_to_nanoseconds(obj, expected):
2424
def test_delta_to_nanoseconds_error():
2525
obj = np.array([123456789], dtype="m8[ns]")
2626

27-
with pytest.raises(TypeError, match="<(class|type) 'numpy.ndarray'>"):
27+
with pytest.raises(TypeError, match="<class 'numpy.ndarray'>"):
2828
delta_to_nanoseconds(obj)

0 commit comments

Comments
 (0)