MCPcopy Create free account
hub / github.com/apache/arrow / test_timestamp_scalar

Function test_timestamp_scalar

python/pyarrow/tests/test_scalars.py:198–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

196
197@pytest.mark.timezone_data
198def test_timestamp_scalar():
199 a = repr(pa.scalar("0000-01-01").cast(pa.timestamp("s")))
200 assert a == "<pyarrow.TimestampScalar: '0000-01-01T00:00:00'>"
201 b = repr(pa.scalar(datetime.datetime(2015, 1, 1), type=pa.timestamp('s', tz='UTC')))
202 assert b == "<pyarrow.TimestampScalar: '2015-01-01T00:00:00+0000'>"
203 c = repr(pa.scalar(datetime.datetime(2015, 1, 1), type=pa.timestamp('us')))
204 assert c == "<pyarrow.TimestampScalar: '2015-01-01T00:00:00.000000'>"
205 d = repr(pc.assume_timezone(
206 pa.scalar("2000-01-01").cast(pa.timestamp("s")), "America/New_York"))
207 assert d == "<pyarrow.TimestampScalar: '2000-01-01T00:00:00-0500'>"
208
209
210def test_bool():

Callers

nothing calls this directly

Calls 3

datetimeMethod · 0.80
castMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected