@@ -480,8 +480,8 @@ def get_locales(prefix=None, normalize=True,
480
480
if prefix is None :
481
481
return _valid_locales (out_locales , normalize )
482
482
483
- found = re .compile ('{prefix}.*' .format (prefix = prefix )) \
484
- .findall ('\n ' .join (out_locales ))
483
+ pattern = re .compile ('{prefix}.*' .format (prefix = prefix ))
484
+ found = pattern .findall ('\n ' .join (out_locales ))
485
485
return _valid_locales (found , normalize )
486
486
487
487
@@ -895,6 +895,7 @@ def _get_ilevel_values(index, level):
895
895
896
896
def assert_class_equal (left , right , exact = True , obj = 'Input' ):
897
897
"""checks classes are equal."""
898
+ __tracebackhide__ = True
898
899
899
900
def repr_class (x ):
900
901
if isinstance (x , Index ):
@@ -934,6 +935,7 @@ def assert_attr_equal(attr, left, right, obj='Attributes'):
934
935
Specify object name being compared, internally used to show appropriate
935
936
assertion message
936
937
"""
938
+ __tracebackhide__ = True
937
939
938
940
left_attr = getattr (left , attr )
939
941
right_attr = getattr (right , attr )
@@ -964,14 +966,14 @@ def assert_is_valid_plot_return_object(objs):
964
966
import matplotlib .pyplot as plt
965
967
if isinstance (objs , (pd .Series , np .ndarray )):
966
968
for el in objs .ravel ():
967
- msg = (' one of \ ' objs\ ' is not a matplotlib Axes instance, type '
968
- ' encountered {name!r}' ).format (name = el .__class__ .__name__ )
969
+ msg = (" one of 'objs' is not a matplotlib Axes instance, type "
970
+ " encountered {name!r}" ).format (name = el .__class__ .__name__ )
969
971
assert isinstance (el , (plt .Axes , dict )), msg
970
972
else :
971
- assert isinstance (objs , (plt .Artist , tuple , dict )), \
972
- ( 'objs is neither an ndarray of Artist instances nor a '
973
- 'single Artist instance, tuple, or dict, "objs" is a {name!r}'
974
- ) .format (name = objs .__class__ .__name__ )
973
+ assert isinstance (objs , (plt .Artist , tuple , dict )), (
974
+ 'objs is neither an ndarray of Artist instances nor a '
975
+ 'single Artist instance, tuple, or dict, "objs" is a {name!r}'
976
+ .format (name = objs .__class__ .__name__ ) )
975
977
976
978
977
979
def isiterable (obj ):
@@ -1102,6 +1104,7 @@ def assert_numpy_array_equal(left, right, strict_nan=False,
1102
1104
Specify object name being compared, internally used to show appropriate
1103
1105
assertion message
1104
1106
"""
1107
+ __tracebackhide__ = True
1105
1108
1106
1109
# instance validation
1107
1110
# Show a detailed error message when classes are different
@@ -1222,6 +1225,7 @@ def assert_series_equal(left, right, check_dtype=True,
1222
1225
Specify object name being compared, internally used to show appropriate
1223
1226
assertion message
1224
1227
"""
1228
+ __tracebackhide__ = True
1225
1229
1226
1230
# instance validation
1227
1231
_check_isinstance (left , right , Series )
@@ -1395,6 +1399,7 @@ def assert_frame_equal(left, right, check_dtype=True,
1395
1399
Ignore differing dtypes in columns with check_dtype.
1396
1400
>>> assert_frame_equal(df1, df2, check_dtype=False)
1397
1401
"""
1402
+ __tracebackhide__ = True
1398
1403
1399
1404
# instance validation
1400
1405
_check_isinstance (left , right , DataFrame )
@@ -1530,6 +1535,8 @@ def assert_equal(left, right, **kwargs):
1530
1535
right : Index, Series, DataFrame, ExtensionArray, or np.ndarray
1531
1536
**kwargs
1532
1537
"""
1538
+ __tracebackhide__ = True
1539
+
1533
1540
if isinstance (left , pd .Index ):
1534
1541
assert_index_equal (left , right , ** kwargs )
1535
1542
elif isinstance (left , pd .Series ):
@@ -2017,8 +2024,9 @@ def makeCustomIndex(nentries, nlevels, prefix='#', names=False, ndupe_l=None,
2017
2024
assert (is_sequence (ndupe_l ) and len (ndupe_l ) <= nlevels )
2018
2025
assert (names is None or names is False or
2019
2026
names is True or len (names ) is nlevels )
2020
- assert idx_type is None or \
2021
- (idx_type in ('i' , 'f' , 's' , 'u' , 'dt' , 'p' , 'td' ) and nlevels == 1 )
2027
+ assert idx_type is None or (idx_type in ('i' , 'f' , 's' , 'u' ,
2028
+ 'dt' , 'p' , 'td' )
2029
+ and nlevels == 1 )
2022
2030
2023
2031
if names is True :
2024
2032
# build default names
@@ -2145,12 +2153,12 @@ def makeCustomDataframe(nrows, ncols, c_idx_names=True, r_idx_names=True,
2145
2153
2146
2154
assert c_idx_nlevels > 0
2147
2155
assert r_idx_nlevels > 0
2148
- assert r_idx_type is None or \
2149
- ( r_idx_type in ( 'i ' , 'f ' , 's' ,
2150
- 'u' , 'dt' , 'p' , 'td' ) and r_idx_nlevels == 1 )
2151
- assert c_idx_type is None or \
2152
- ( c_idx_type in ( 'i ' , 'f ' , 's' ,
2153
- 'u' , 'dt' , 'p' , 'td' ) and c_idx_nlevels == 1 )
2156
+ assert r_idx_type is None or ( r_idx_type in ( 'i' , 'f' , 's' ,
2157
+ 'u ' , 'dt ' , 'p' , 'td' )
2158
+ and r_idx_nlevels == 1 )
2159
+ assert c_idx_type is None or ( c_idx_type in ( 'i' , 'f' , 's' ,
2160
+ 'u ' , 'dt ' , 'p' , 'td' )
2161
+ and c_idx_nlevels == 1 )
2154
2162
2155
2163
columns = makeCustomIndex (ncols , nlevels = c_idx_nlevels , prefix = 'C' ,
2156
2164
names = c_idx_names , ndupe_l = c_ndupe_l ,
@@ -2483,7 +2491,7 @@ def wrapper(*args, **kwargs):
2483
2491
2484
2492
def assert_raises_regex (_exception , _regexp , _callable = None ,
2485
2493
* args , ** kwargs ):
2486
- """
2494
+ r """
2487
2495
Check that the specified Exception is raised and that the error message
2488
2496
matches a given regular expression pattern. This may be a regular
2489
2497
expression object or a string containing a regular expression suitable
@@ -2665,6 +2673,8 @@ class for all warnings. To check that no warning is returned,
2665
2673
2666
2674
..warn:: This is *not* thread-safe.
2667
2675
"""
2676
+ __tracebackhide__ = True
2677
+
2668
2678
with warnings .catch_warnings (record = True ) as w :
2669
2679
2670
2680
if clear is not None :
0 commit comments