Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 6edf1ef

Browse files
tswastchalmerlowe
authored andcommitted
chore: update tests to be compatible with pandas 2.0 (#1538)
* chore: update tests to be compatible with pandas 2.0 * use StringDtype without storage argument * avoid Float64Dtype on older pandas
1 parent 5362795 commit 6edf1ef

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/unit/test_table.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3486,15 +3486,22 @@ def test_to_dataframe_w_dtypes_mapper(self):
34863486
create_bqstorage_client=False,
34873487
bool_dtype=pandas.BooleanDtype(),
34883488
int_dtype=pandas.Int32Dtype(),
3489-
float_dtype=pandas.StringDtype(),
3489+
float_dtype=(
3490+
pandas.Float64Dtype()
3491+
if hasattr(pandas, "Float64Dtype")
3492+
else pandas.StringDtype()
3493+
),
34903494
string_dtype=pandas.StringDtype(),
34913495
)
34923496

34933497
self.assertIsInstance(df, pandas.DataFrame)
34943498
self.assertEqual(df.complete.dtype.name, "boolean")
34953499
self.assertEqual(df.age.dtype.name, "Int32")
34963500
self.assertEqual(df.seconds.dtype.name, "Int32")
3497-
self.assertEqual(df.miles.dtype.name, "string")
3501+
self.assertEqual(
3502+
df.miles.dtype.name,
3503+
"Float64" if hasattr(pandas, "Float64Dtype") else "string",
3504+
)
34983505
self.assertEqual(df.name.dtype.name, "string")
34993506

35003507
@unittest.skipIf(pandas is None, "Requires `pandas`")

0 commit comments

Comments
 (0)