File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 99
1010from pandas ._libs import Interval , Period , algos
1111from pandas ._libs .tslibs import conversion
12- from pandas ._typing import ArrayLike , DtypeObj
12+ from pandas ._typing import ArrayLike , DtypeObj , Optional
1313
1414from pandas .core .dtypes .base import registry
1515from pandas .core .dtypes .dtypes import (
@@ -1732,7 +1732,7 @@ def _validate_date_like_dtype(dtype) -> None:
17321732 )
17331733
17341734
1735- def validate_all_hashable (* args , error_name = None ) -> None :
1735+ def validate_all_hashable (* args , error_name : Optional [ str ] = None ) -> None :
17361736 """
17371737 Return None if all args are hashable, else raise a TypeError.
17381738
Original file line number Diff line number Diff line change @@ -746,3 +746,13 @@ def test_astype_object_preserves_datetime_na(from_type):
746746 result = astype_nansafe (arr , dtype = "object" )
747747
748748 assert isna (result )[0 ]
749+
750+
751+ def test_validate_allhashable ():
752+ assert com .validate_all_hashable (1 , "a" ) is None
753+
754+ with pytest .raises (TypeError , match = "All elements must be hashable" ):
755+ com .validate_all_hashable ([])
756+
757+ with pytest .raises (TypeError , match = "list must be a hashable type" ):
758+ com .validate_all_hashable ([], error_name = "list" )
You can’t perform that action at this time.
0 commit comments