How to use the arq.jobs.DatetimeJob.encode_raw function in arq

To help you get started, we’ve selected a few arq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github samuelcolvin / arq / tests / test_customisation.py View on Github external
def test_dt_encoding_with_μs():
    t = datetime(2000, 1, 1, 0, 0, 0, 123456)
    assert str(t) == '2000-01-01 00:00:00.123456'
    p = DatetimeJob.encode_raw(t)
    t2 = DatetimeJob.decode_raw(p)
    assert t != t2
    assert (t - t2) == timedelta(microseconds=456)
    assert str(t2) == '2000-01-01 00:00:00.123000'
github samuelcolvin / arq / tests / test_customisation.py View on Github external
def test_dt_encoding_with_ms():
    t = datetime(2000, 1, 1, 0, 0, 0, 123000)
    assert str(t) == '2000-01-01 00:00:00.123000'
    p = DatetimeJob.encode_raw(t)
    t2 = DatetimeJob.decode_raw(p)
    assert t == t2
    assert str(t2) == '2000-01-01 00:00:00.123000'
github samuelcolvin / arq / tests / test_customisation.py View on Github external
def test_naïve_dt_encoding():
    t = datetime(2000, 1, 1)
    assert str(t) == '2000-01-01 00:00:00'
    p = DatetimeJob.encode_raw(t)
    t2 = DatetimeJob.decode_raw(p)
    assert t == t2
    assert str(t2) == '2000-01-01 00:00:00'
github samuelcolvin / arq / tests / test_customisation.py View on Github external
def test_utc_dt_encoding():
    t = datetime(2000, 1, 1, tzinfo=timezone.utc)
    assert str(t) == '2000-01-01 00:00:00+00:00'
    p = DatetimeJob.encode_raw(t)
    t2 = DatetimeJob.decode_raw(p)
    assert t == t2
    assert str(t2) == '2000-01-01 00:00:00+00:00'
github samuelcolvin / arq / tests / test_customisation.py View on Github external
def test_new_york_dt_encoding():
    t = datetime(2000, 1, 1, tzinfo=timezone(timedelta(hours=-5)))
    assert str(t) == '2000-01-01 00:00:00-05:00'
    p = DatetimeJob.encode_raw(t)
    t2 = DatetimeJob.decode_raw(p)
    assert t == t2
    assert str(t2) == '2000-01-01 00:00:00-05:00'
github samuelcolvin / arq / tests / test_customisation.py View on Github external
def test_pytz_new_york_dt_encoding():
    ny = pytz.timezone('America/New_York')
    t = ny.localize(datetime(2000, 1, 1))
    assert str(t) == '2000-01-01 00:00:00-05:00'
    p = DatetimeJob.encode_raw(t)
    t2 = DatetimeJob.decode_raw(p)
    assert t == t2
    assert datetime(2000, 1, 1, tzinfo=timezone(timedelta(hours=-5))) == t2
    assert str(t2) == '2000-01-01 00:00:00-05:00'