コード例 #1
0
def test_datetime_from_timestamp(dt):
    if PYPY and dt < pdt.datetime(1900, 1, 1):
        pytest.xfail(
            "pdt.datetime.timestamp will raise on PyPy with dates before 1900")

    ts = pdt.datetime.timestamp(dt)
    assert rdt.datetime_from_timestamp(ts) == pdt.datetime.fromtimestamp(ts)
コード例 #2
0
def test_datetime_from_timestamp_tzinfo():
    d1 = rdt.datetime_from_timestamp(0, tz=UTC)
    d2 = rdt.datetime_from_timestamp(0, tz=UTC)

    assert d1 == d2
    assert d1.tzinfo is d2.tzinfo