@@ -3651,8 +3651,7 @@ def _convert_slice_indexer(self, key: slice, kind: str_t):
3651
3651
key : label of the slice bound
3652
3652
kind : {'loc', 'getitem'}
3653
3653
"""
3654
- if kind not in ["loc" , "getitem" ]:
3655
- raise ValueError ('Value for kind argument must be one of: loc, getitem' )
3654
+ assert kind in ["loc" , "getitem" ], kind
3656
3655
3657
3656
# potentially cast the bounds to integers
3658
3657
start , stop , step = key .start , key .stop , key .step
@@ -5679,8 +5678,7 @@ def _validate_indexer(self, form: str_t, key, kind: str_t):
5679
5678
If we are positional indexer, validate that we have appropriate
5680
5679
typed bounds must be an integer.
5681
5680
"""
5682
- if kind not in ["getitem" , "iloc" ]:
5683
- raise ValueError ('Value for kind argument must be one of: getitem, iloc' )
5681
+ assert kind in ["getitem" , "iloc" ]
5684
5682
5685
5683
if key is not None and not is_integer (key ):
5686
5684
raise self ._invalid_indexer (form , key )
@@ -5710,9 +5708,7 @@ def _maybe_cast_slice_bound(
5710
5708
-----
5711
5709
Value of `side` parameter should be validated in caller.
5712
5710
"""
5713
- if kind not in ["loc" , "getitem" , None , no_default ]:
5714
- raise ValueError ('Value for kind argument must be one of: '
5715
- 'loc, getitem or None' )
5711
+ assert kind in ["loc" , "getitem" , None , no_default ]
5716
5712
self ._deprecated_arg (kind , "kind" , "_maybe_cast_slice_bound" )
5717
5713
5718
5714
# We are a plain index here (sub-class override this method if they
0 commit comments