Skip to content

Commit

Permalink
chore: update tests to be compatible with pandas 2.0 (#1538)
Browse files Browse the repository at this point in the history
* chore: update tests to be compatible with pandas 2.0

* use StringDtype without storage argument

* avoid Float64Dtype on older pandas
  • Loading branch information
tswast authored Mar 30, 2023
1 parent 5d0ebf4 commit 67698f7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/unit/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -3486,15 +3486,22 @@ def test_to_dataframe_w_dtypes_mapper(self):
create_bqstorage_client=False,
bool_dtype=pandas.BooleanDtype(),
int_dtype=pandas.Int32Dtype(),
float_dtype=pandas.StringDtype(),
float_dtype=(
pandas.Float64Dtype()
if hasattr(pandas, "Float64Dtype")
else pandas.StringDtype()
),
string_dtype=pandas.StringDtype(),
)

self.assertIsInstance(df, pandas.DataFrame)
self.assertEqual(df.complete.dtype.name, "boolean")
self.assertEqual(df.age.dtype.name, "Int32")
self.assertEqual(df.seconds.dtype.name, "Int32")
self.assertEqual(df.miles.dtype.name, "string")
self.assertEqual(
df.miles.dtype.name,
"Float64" if hasattr(pandas, "Float64Dtype") else "string",
)
self.assertEqual(df.name.dtype.name, "string")

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

0 comments on commit 67698f7

Please sign in to comment.