75
75
def test_orc ():
76
76
with ensure_clean () as path :
77
77
check (assert_type (DF .to_orc (path ), None ), type (None ))
78
- check (assert_type (read_orc (path ), DataFrame ), DataFrame )
78
+ with pytest_warns_bounded (
79
+ DeprecationWarning ,
80
+ "Passing a BlockManager to DataFrame is deprecated" ,
81
+ lower = "2.1.99" ,
82
+ ):
83
+ check (assert_type (read_orc (path ), DataFrame ), DataFrame )
79
84
80
85
81
86
@pytest .mark .skipif (WINDOWS , reason = "ORC not available on windows" )
82
87
def test_orc_path ():
83
88
with ensure_clean () as path :
84
89
pathlib_path = Path (path )
85
90
check (assert_type (DF .to_orc (pathlib_path ), None ), type (None ))
86
- check (assert_type (read_orc (pathlib_path ), DataFrame ), DataFrame )
91
+ with pytest_warns_bounded (
92
+ DeprecationWarning ,
93
+ "Passing a BlockManager to DataFrame is deprecated" ,
94
+ lower = "2.1.99" ,
95
+ ):
96
+ check (assert_type (read_orc (pathlib_path ), DataFrame ), DataFrame )
87
97
88
98
89
99
@pytest .mark .skipif (WINDOWS , reason = "ORC not available on windows" )
@@ -93,14 +103,24 @@ def test_orc_buffer():
93
103
check (assert_type (DF .to_orc (file_w ), None ), type (None ))
94
104
95
105
with open (path , "rb" ) as file_r :
96
- check (assert_type (read_orc (file_r ), DataFrame ), DataFrame )
106
+ with pytest_warns_bounded (
107
+ DeprecationWarning ,
108
+ "Passing a BlockManager to DataFrame is deprecated" ,
109
+ lower = "2.1.99" ,
110
+ ):
111
+ check (assert_type (read_orc (file_r ), DataFrame ), DataFrame )
97
112
98
113
99
114
@pytest .mark .skipif (WINDOWS , reason = "ORC not available on windows" )
100
115
def test_orc_columns ():
101
116
with ensure_clean () as path :
102
117
check (assert_type (DF .to_orc (path , index = False ), None ), type (None ))
103
- check (assert_type (read_orc (path , columns = ["a" ]), DataFrame ), DataFrame )
118
+ with pytest_warns_bounded (
119
+ DeprecationWarning ,
120
+ "Passing a BlockManager to DataFrame is deprecated" ,
121
+ lower = "2.1.99" ,
122
+ ):
123
+ check (assert_type (read_orc (path , columns = ["a" ]), DataFrame ), DataFrame )
104
124
105
125
106
126
@pytest .mark .skipif (WINDOWS , reason = "ORC not available on windows" )
@@ -524,7 +544,12 @@ def test_parquet():
524
544
with ensure_clean () as path :
525
545
check (assert_type (DF .to_parquet (path ), None ), type (None ))
526
546
check (assert_type (DF .to_parquet (), bytes ), bytes )
527
- check (assert_type (read_parquet (path ), DataFrame ), DataFrame )
547
+ with pytest_warns_bounded (
548
+ DeprecationWarning ,
549
+ "Passing a BlockManager to DataFrame is deprecated" ,
550
+ lower = "2.1.99" ,
551
+ ):
552
+ check (assert_type (read_parquet (path ), DataFrame ), DataFrame )
528
553
529
554
530
555
def test_parquet_options ():
@@ -533,18 +558,33 @@ def test_parquet_options():
533
558
assert_type (DF .to_parquet (path , compression = None , index = True ), None ),
534
559
type (None ),
535
560
)
536
- check (assert_type (read_parquet (path ), DataFrame ), DataFrame )
561
+ with pytest_warns_bounded (
562
+ DeprecationWarning ,
563
+ "Passing a BlockManager to DataFrame is deprecated" ,
564
+ lower = "2.1.99" ,
565
+ ):
566
+ check (assert_type (read_parquet (path ), DataFrame ), DataFrame )
537
567
538
568
539
569
def test_feather ():
540
570
with ensure_clean () as path :
541
571
check (assert_type (DF .to_feather (path ), None ), type (None ))
542
- check (assert_type (read_feather (path ), DataFrame ), DataFrame )
543
- check (assert_type (read_feather (path , columns = ["a" ]), DataFrame ), DataFrame )
572
+ with pytest_warns_bounded (
573
+ DeprecationWarning ,
574
+ "Passing a BlockManager to DataFrame is deprecated" ,
575
+ lower = "2.1.99" ,
576
+ ):
577
+ check (assert_type (read_feather (path ), DataFrame ), DataFrame )
578
+ check (assert_type (read_feather (path , columns = ["a" ]), DataFrame ), DataFrame )
544
579
with io .BytesIO () as bio :
545
580
check (assert_type (DF .to_feather (bio ), None ), type (None ))
546
581
bio .seek (0 )
547
- check (assert_type (read_feather (bio ), DataFrame ), DataFrame )
582
+ with pytest_warns_bounded (
583
+ DeprecationWarning ,
584
+ "Passing a BlockManager to DataFrame is deprecated" ,
585
+ lower = "2.1.99" ,
586
+ ):
587
+ check (assert_type (read_feather (bio ), DataFrame ), DataFrame )
548
588
549
589
550
590
def test_read_csv ():
@@ -1394,25 +1434,42 @@ def test_all_read_without_lxml_dtype_backend() -> None:
1394
1434
1395
1435
if not WINDOWS :
1396
1436
check (assert_type (DF .to_orc (path ), None ), type (None ))
1437
+ with pytest_warns_bounded (
1438
+ DeprecationWarning ,
1439
+ "Passing a BlockManager to DataFrame is deprecated" ,
1440
+ lower = "2.1.99" ,
1441
+ ):
1442
+ check (
1443
+ assert_type (
1444
+ read_orc (path , dtype_backend = "numpy_nullable" ), DataFrame
1445
+ ),
1446
+ DataFrame ,
1447
+ )
1448
+ check (assert_type (DF .to_feather (path ), None ), type (None ))
1449
+ with pytest_warns_bounded (
1450
+ DeprecationWarning ,
1451
+ "Passing a BlockManager to DataFrame is deprecated" ,
1452
+ lower = "2.1.99" ,
1453
+ ):
1397
1454
check (
1398
- assert_type (read_orc (path , dtype_backend = "numpy_nullable " ), DataFrame ),
1455
+ assert_type (read_feather (path , dtype_backend = "pyarrow " ), DataFrame ),
1399
1456
DataFrame ,
1400
1457
)
1401
- check (assert_type (DF .to_feather (path ), None ), type (None ))
1402
- check (
1403
- assert_type (read_feather (path , dtype_backend = "pyarrow" ), DataFrame ),
1404
- DataFrame ,
1405
- )
1406
1458
1407
- check (
1408
- assert_type (
1409
- pd .to_numeric (
1410
- [1.0 , 2.0 , "blerg" ], errors = "ignore" , dtype_backend = "numpy_nullable"
1459
+ with pytest_warns_bounded (
1460
+ FutureWarning , "errors='ignore' is deprecated" , lower = "2.1.99"
1461
+ ):
1462
+ check (
1463
+ assert_type (
1464
+ pd .to_numeric (
1465
+ [1.0 , 2.0 , "blerg" ],
1466
+ errors = "ignore" ,
1467
+ dtype_backend = "numpy_nullable" ,
1468
+ ),
1469
+ npt .NDArray ,
1411
1470
),
1412
- npt .NDArray ,
1413
- ),
1414
- np .ndarray ,
1415
- )
1471
+ np .ndarray ,
1472
+ )
1416
1473
1417
1474
with ensure_clean (".xlsx" ) as path :
1418
1475
as_str : str = path
0 commit comments