Ejemplo n.º 1
0
def test_bind_customdatetype():
    os.environ['TZ'] = "Europe/Paris"
    a = CustomDateType()
    date = datetime.datetime(2012,1,1,1,1)
    assert a.process_bind_param(date, "nutt") == 1325376060
    date = 1504545454
    assert a.process_bind_param(date, "nutt") == 1504545454
    t = int(time.time())

    assert a.process_bind_param("", "nutt") >= t
    assert a.process_bind_param("", "nutt") <= t + 6000
Ejemplo n.º 2
0
def test_result_customdatetype():
    os.environ['TZ'] = "Europe/Paris"
    a = CustomDateType()
    date = datetime.datetime(2012,1,1,1,1)
    timestamp = 1325376060
    assert a.process_result_value(timestamp, "nutt") == date