|
1 |
| -from datetime import datetime, time, date |
| 1 | +from datetime import date, datetime, time |
2 | 2 | from decimal import Decimal
|
3 | 3 |
|
4 | 4 | import isodate
|
5 | 5 | import polars as pl
|
| 6 | +import pytest |
6 | 7 | import pytz
|
7 | 8 | from dateutil.tz import tzutc
|
8 | 9 |
|
@@ -168,36 +169,37 @@ def test_polars_write_constraints():
|
168 | 169 | ]
|
169 | 170 |
|
170 | 171 |
|
171 |
| -# def test_polars_parser_write_timezone(): |
172 |
| -# # This Test fails because polars does not allow mixing tz aware time with naive time. |
173 |
| -# source = TableResource(path="data/timezone.csv") |
174 |
| -# target = source.write(format="polars") |
175 |
| -# with target: |
176 |
| -# # Assert schema |
177 |
| -# assert target.schema.to_descriptor() == { |
178 |
| -# "fields": [ |
179 |
| -# {"name": "datetime", "type": "datetime"}, |
180 |
| -# {"name": "time", "type": "time"}, |
181 |
| -# ], |
182 |
| -# } |
183 |
| -# # Polars disallows comparing naive tzs with explicit tzs |
184 |
| -# # https://github.com/pola-rs/polars/pull/12966#pullrequestreview-1785291945 |
185 |
| -# # Assert rows |
186 |
| -# assert target.read_rows() == [ |
187 |
| -# { |
188 |
| -# "datetime": datetime(2020, 1, 1, 15, 0, tzinfo=tzutc()), |
189 |
| -# "time": time(15), |
190 |
| -# }, |
191 |
| -# { |
192 |
| -# "datetime": datetime(2020, 1, 1, 15, 0, tzinfo=tzutc()), |
193 |
| -# "time": time(15), |
194 |
| -# }, |
195 |
| -# { |
196 |
| -# "datetime": datetime(2020, 1, 1, 12, 0, tzinfo=tzutc()), |
197 |
| -# "time": time(12), |
198 |
| -# }, |
199 |
| -# { |
200 |
| -# "datetime": datetime(2020, 1, 1, 18, 0, tzinfo=tzutc()), |
201 |
| -# "time": time(18), |
202 |
| -# }, |
203 |
| -# ] |
| 172 | +# This Test fails because polars does not allow mixing tz aware time with naive time. |
| 173 | +@pytest.mark.skip |
| 174 | +def test_polars_parser_write_timezone(): |
| 175 | + source = TableResource(path="data/timezone.csv") |
| 176 | + target = source.write(format="polars") |
| 177 | + with target: |
| 178 | + # Assert schema |
| 179 | + assert target.schema.to_descriptor() == { |
| 180 | + "fields": [ |
| 181 | + {"name": "datetime", "type": "datetime"}, |
| 182 | + {"name": "time", "type": "time"}, |
| 183 | + ], |
| 184 | + } |
| 185 | + # Polars disallows comparing naive tzs with explicit tzs |
| 186 | + # https://github.com/pola-rs/polars/pull/12966#pullrequestreview-1785291945 |
| 187 | + # Assert rows |
| 188 | + assert target.read_rows() == [ |
| 189 | + { |
| 190 | + "datetime": datetime(2020, 1, 1, 15, 0, tzinfo=tzutc()), |
| 191 | + "time": time(15), |
| 192 | + }, |
| 193 | + { |
| 194 | + "datetime": datetime(2020, 1, 1, 15, 0, tzinfo=tzutc()), |
| 195 | + "time": time(15), |
| 196 | + }, |
| 197 | + { |
| 198 | + "datetime": datetime(2020, 1, 1, 12, 0, tzinfo=tzutc()), |
| 199 | + "time": time(12), |
| 200 | + }, |
| 201 | + { |
| 202 | + "datetime": datetime(2020, 1, 1, 18, 0, tzinfo=tzutc()), |
| 203 | + "time": time(18), |
| 204 | + }, |
| 205 | + ] |
0 commit comments