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_bind(self):
        a = CustomDateType()
        date = datetime.datetime(2012,1,1,1,1)
        self.assertEqual(a.process_bind_param(date, "nutt"),
                            1325376060)
        date = 1504545454
        self.assertEqual(a.process_bind_param(date, "nutt"),
                            1504545454)
        t = int(time.time())

        self.assertTrue(a.process_bind_param("", "nutt") >= t)
        self.assertTrue(a.process_bind_param("", "nutt") <= t + 6000)
Ejemplo n.º 3
0
 def test_result(self):
     a = CustomDateType()
     date = datetime.datetime(2012,1,1,1,1)
     timestamp = 1325376060
     self.assertEqual(a.process_result_value(timestamp, "nutt"),
                      date)
Ejemplo n.º 4
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