@@ -1356,18 +1356,12 @@ def test_frame_setitem_empty_dataframe(self):
1356
1356
def test_full_setter_loc_incompatible_dtype ():
1357
1357
# https://github.com/pandas-dev/pandas/issues/55791
1358
1358
df = DataFrame ({"a" : [1 , 2 ]})
1359
- with tm . assert_produces_warning ( FutureWarning , match = "incompatible dtype " ):
1359
+ with pytest . raises ( TypeError , match = "Invalid value " ):
1360
1360
df .loc [:, "a" ] = True
1361
- expected = DataFrame ({"a" : [True , True ]})
1362
- tm .assert_frame_equal (df , expected )
1363
1361
1364
- df = DataFrame ({"a" : [1 , 2 ]})
1365
- with tm .assert_produces_warning (FutureWarning , match = "incompatible dtype" ):
1362
+ with pytest .raises (TypeError , match = "Invalid value" ):
1366
1363
df .loc [:, "a" ] = {0 : 3.5 , 1 : 4.5 }
1367
- expected = DataFrame ({"a" : [3.5 , 4.5 ]})
1368
- tm .assert_frame_equal (df , expected )
1369
1364
1370
- df = DataFrame ({"a" : [1 , 2 ]})
1371
1365
df .loc [:, "a" ] = {0 : 3 , 1 : 4 }
1372
1366
expected = DataFrame ({"a" : [3 , 4 ]})
1373
1367
tm .assert_frame_equal (df , expected )
0 commit comments