@@ -109,14 +109,11 @@ def test_none_to_nan(cls, dtype):
109
109
def test_setitem_validates (cls , dtype ):
110
110
arr = cls ._from_sequence (["a" , "b" ], dtype = dtype )
111
111
112
- if dtype .storage == "python" :
113
- msg = "Cannot set non-string value '10' into a StringArray."
114
- else :
115
- msg = "Scalar must be NA or str"
112
+ msg = "Invalid value '10' for dtype 'str"
116
113
with pytest .raises (TypeError , match = msg ):
117
114
arr [0 ] = 10
118
115
119
- msg = "Must provide strings "
116
+ msg = "Invalid value for dtype 'str "
120
117
with pytest .raises (TypeError , match = msg ):
121
118
arr [:] = np .array ([1 , 2 ])
122
119
@@ -508,10 +505,7 @@ def test_fillna_args(dtype):
508
505
expected = pd .array (["a" , "b" ], dtype = dtype )
509
506
tm .assert_extension_array_equal (res , expected )
510
507
511
- if dtype .storage == "pyarrow" :
512
- msg = "Invalid value '1' for dtype str"
513
- else :
514
- msg = "Cannot set non-string value '1' into a StringArray."
508
+ msg = "Invalid value '1' for dtype 'str"
515
509
with pytest .raises (TypeError , match = msg ):
516
510
arr .fillna (value = 1 )
517
511
@@ -727,10 +721,7 @@ def test_setitem_scalar_with_mask_validation(dtype):
727
721
728
722
# for other non-string we should also raise an error
729
723
ser = pd .Series (["a" , "b" , "c" ], dtype = dtype )
730
- if dtype .storage == "python" :
731
- msg = "Cannot set non-string value"
732
- else :
733
- msg = "Scalar must be NA or str"
724
+ msg = "Invalid value '1' for dtype 'str"
734
725
with pytest .raises (TypeError , match = msg ):
735
726
ser [mask ] = 1
736
727
0 commit comments