Skip to content

Commit 77f4df9

Browse files
authored
Merge branch 'main' into tswast-patch-1
2 parents c0ebe6e + 147aad9 commit 77f4df9

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

bigframes/operations/datetimes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from bigframes.core import log_adapter
2626
import bigframes.operations as ops
2727

28-
_ONE_DAY = pandas.Timedelta("1d")
28+
_ONE_DAY = pandas.Timedelta("1D")
2929
_ONE_SECOND = pandas.Timedelta("1s")
3030
_ONE_MICRO = pandas.Timedelta("1us")
3131
_SUPPORTED_FREQS = ("Y", "Q", "M", "W", "D", "h", "min", "s", "ms", "us")

conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@
1414

1515
from __future__ import annotations
1616

17+
import warnings
18+
1719
import numpy as np
1820
import pandas as pd
1921
import pyarrow as pa
2022
import pytest
2123

2224
import bigframes._config
2325

26+
# Make sure SettingWithCopyWarning is ignored if it exists.
27+
# It was removed in pandas 3.0.
28+
if hasattr(pd.errors, "SettingWithCopyWarning"):
29+
warnings.simplefilter("ignore", pd.errors.SettingWithCopyWarning)
30+
2431

2532
@pytest.fixture(scope="session")
2633
def polars_session_or_bpd():

pytest.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[pytest]
22
doctest_optionflags = NORMALIZE_WHITESPACE
3-
filterwarnings =
4-
ignore::pandas.errors.SettingWithCopyWarning
53
addopts = "--import-mode=importlib"

tests/unit/test_local_data.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
def test_local_data_well_formed_round_trip():
4545
local_entry = local_data.ManagedArrowTable.from_pandas(pd_data)
4646
result = pd.DataFrame(local_entry.itertuples(), columns=pd_data.columns)
47+
result = result.assign(
48+
**{
49+
col: result[col].astype(pd_data_normalized[col].dtype)
50+
for col in pd_data_normalized.columns
51+
}
52+
)
4753
pandas.testing.assert_frame_equal(pd_data_normalized, result, check_dtype=False)
4854

4955

@@ -118,6 +124,12 @@ def test_local_data_well_formed_round_trip_chunked():
118124
as_rechunked_pyarrow = pa.Table.from_batches(pa_table.to_batches(max_chunksize=2))
119125
local_entry = local_data.ManagedArrowTable.from_pyarrow(as_rechunked_pyarrow)
120126
result = pd.DataFrame(local_entry.itertuples(), columns=pd_data.columns)
127+
result = result.assign(
128+
**{
129+
col: result[col].astype(pd_data_normalized[col].dtype)
130+
for col in pd_data_normalized.columns
131+
}
132+
)
121133
pandas.testing.assert_frame_equal(pd_data_normalized, result, check_dtype=False)
122134

123135

@@ -126,6 +138,12 @@ def test_local_data_well_formed_round_trip_sliced():
126138
as_rechunked_pyarrow = pa.Table.from_batches(pa_table.slice(0, 4).to_batches())
127139
local_entry = local_data.ManagedArrowTable.from_pyarrow(as_rechunked_pyarrow)
128140
result = pd.DataFrame(local_entry.itertuples(), columns=pd_data.columns)
141+
result = result.assign(
142+
**{
143+
col: result[col].astype(pd_data_normalized[col].dtype)
144+
for col in pd_data_normalized.columns
145+
}
146+
)
129147
pandas.testing.assert_frame_equal(
130148
pd_data_normalized[0:4].reset_index(drop=True),
131149
result.reset_index(drop=True),

0 commit comments

Comments
 (0)