@@ -404,14 +404,17 @@ def _validate_specification(self):
404
404
elif self .left_on is not None :
405
405
n = len (self .left_on )
406
406
if self .right_index :
407
- assert (len (self .left_on ) == self .right .index .nlevels )
407
+ if not ((len (self .left_on ) == self .right .index .nlevels )):
408
+ raise AssertionError ()
408
409
self .right_on = [None ] * n
409
410
elif self .right_on is not None :
410
411
n = len (self .right_on )
411
412
if self .left_index :
412
- assert (len (self .right_on ) == self .left .index .nlevels )
413
+ if not ((len (self .right_on ) == self .left .index .nlevels )):
414
+ raise AssertionError ()
413
415
self .left_on = [None ] * n
414
- assert (len (self .right_on ) == len (self .left_on ))
416
+ if not ((len (self .right_on ) == len (self .left_on ))):
417
+ raise AssertionError ()
415
418
416
419
417
420
def _get_join_indexers (left_keys , right_keys , sort = False , how = 'inner' ):
@@ -424,7 +427,8 @@ def _get_join_indexers(left_keys, right_keys, sort=False, how='inner'):
424
427
-------
425
428
426
429
"""
427
- assert (len (left_keys ) == len (right_keys ))
430
+ if not ((len (left_keys ) == len (right_keys ))):
431
+ raise AssertionError ()
428
432
429
433
left_labels = []
430
434
right_labels = []
@@ -537,8 +541,9 @@ def _left_join_on_index(left_ax, right_ax, join_keys, sort=False):
537
541
left_indexer = None
538
542
539
543
if len (join_keys ) > 1 :
540
- assert (isinstance (right_ax , MultiIndex ) and
541
- len (join_keys ) == right_ax .nlevels )
544
+ if not ((isinstance (right_ax , MultiIndex ) and
545
+ len (join_keys ) == right_ax .nlevels ) ):
546
+ raise AssertionError ()
542
547
543
548
left_tmp , right_indexer = \
544
549
_get_multiindex_indexer (join_keys , right_ax ,
@@ -637,7 +642,8 @@ def __init__(self, data_list, join_index, indexers, axis=1, copy=True):
637
642
if axis <= 0 : # pragma: no cover
638
643
raise MergeError ('Only axis >= 1 supported for this operation' )
639
644
640
- assert (len (data_list ) == len (indexers ))
645
+ if not ((len (data_list ) == len (indexers ))):
646
+ raise AssertionError ()
641
647
642
648
self .units = []
643
649
for data , indexer in zip (data_list , indexers ):
@@ -925,7 +931,8 @@ def __init__(self, objs, axis=0, join='outer', join_axes=None,
925
931
axis = 1 if axis == 0 else 0
926
932
927
933
self ._is_series = isinstance (sample , Series )
928
- assert (0 <= axis <= sample .ndim )
934
+ if not ((0 <= axis <= sample .ndim )):
935
+ raise AssertionError ()
929
936
930
937
# note: this is the BlockManager axis (since DataFrame is transposed)
931
938
self .axis = axis
@@ -1084,7 +1091,8 @@ def _concat_single_item(self, objs, item):
1084
1091
to_concat .append (item_values )
1085
1092
1086
1093
# this method only gets called with axis >= 1
1087
- assert (self .axis >= 1 )
1094
+ if not ((self .axis >= 1 )):
1095
+ raise AssertionError ()
1088
1096
return com ._concat_compat (to_concat , axis = self .axis - 1 )
1089
1097
1090
1098
def _get_result_dim (self ):
@@ -1103,7 +1111,8 @@ def _get_new_axes(self):
1103
1111
continue
1104
1112
new_axes [i ] = self ._get_comb_axis (i )
1105
1113
else :
1106
- assert (len (self .join_axes ) == ndim - 1 )
1114
+ if not ((len (self .join_axes ) == ndim - 1 )):
1115
+ raise AssertionError ()
1107
1116
1108
1117
# ufff...
1109
1118
indices = range (ndim )
0 commit comments