Skip to content

Commit

Permalink
Add failing date32 polars test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Mar 22, 2024
1 parent 1784551 commit 8ac99b1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions python/vegafusion/tests/test_pretransform.py
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,23 @@ def test_date32_pre_transform_dataset():
pd.Timestamp('2022-01-03 00:00:00-0500', tz='America/New_York')
]

def test_date32_pre_transform_dataset_polars():
# Test to make sure that date32 columns are interpreted in the local timezone
dates_df = pl.DataFrame({
"date_col": [date(2022, 1, 1), date(2022, 1, 2), date(2022, 1, 3)],
})
spec = date_column_spec()

(output_ds,), warnings = vf.runtime.pre_transform_datasets(
spec, ["data_0"], "America/New_York", default_input_tz="UTC", inline_datasets=dict(dates=dates_df)
)

# Timestamps are in the local timezone, so they should be midnight local time
assert list(output_ds["date_col"]) == [
pd.Timestamp('2022-01-01 00:00:00-0500', tz='America/New_York'),
pd.Timestamp('2022-01-02 00:00:00-0500', tz='America/New_York'),
pd.Timestamp('2022-01-03 00:00:00-0500', tz='America/New_York')
]

def test_date32_in_timeunit_duckdb_crash():
try:
Expand Down

0 comments on commit 8ac99b1

Please sign in to comment.