Ejemplo n.º 1
0
 def test_date_time_sub_seconds_floating_point(self):
     ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 510241)
     with self.assertWarnsRegex(DeprecationWarning, "adapter"):
         self.cur.execute("insert into test(ts) values (?)", (ts, ))
     self.cur.execute("select ts from test")
     with self.assertWarnsRegex(DeprecationWarning, "converter"):
         ts2 = self.cur.fetchone()[0]
     self.assertEqual(ts, ts2)
Ejemplo n.º 2
0
 def test_sqlite_timestamp(self):
     ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0)
     with self.assertWarnsRegex(DeprecationWarning, "adapter") as cm:
         self.cur.execute("insert into test(ts) values (?)", (ts, ))
     self.assertEqual(cm.filename, __file__)
     self.cur.execute("select ts from test")
     with self.assertWarnsRegex(DeprecationWarning, "converter") as cm:
         ts2 = self.cur.fetchone()[0]
     self.assertEqual(cm.filename, __file__)
     self.assertEqual(ts, ts2)
Ejemplo n.º 3
0
 def CheckTimestamp(self):
     ts = sqlite.Timestamp(2004, 10, 28, 12, 39, 35)
Ejemplo n.º 4
0
 def CheckDateTimeSubSecondsFloatingPoint(self):
     ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 510241)
     self.cur.execute("insert into test(ts) values (?)", (ts, ))
     self.cur.execute("select ts from test")
     ts2 = self.cur.fetchone()[0]
     self.failUnlessEqual(ts, ts2)
Ejemplo n.º 5
0
 def CheckSqliteTimestamp(self):
     ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0)
     self.cur.execute("insert into test(ts) values (?)", (ts, ))
     self.cur.execute("select ts from test")
     ts2 = self.cur.fetchone()[0]
     self.failUnlessEqual(ts, ts2)
Ejemplo n.º 6
0
 def test_to_timestamp(self):
     import sqlite3
     self.assertEquals(converting.ical_datetime_to_timestamp("DTSTART:20140304T083000Z"),
                       sqlite3.Timestamp(2014, 3, 4, 10, 30, 0))
Ejemplo n.º 7
0
 def CheckDateTimeSubSeconds(self):
     ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 500000)
     self.cur.execute('insert into test(ts) values (?)', (ts, ))
     self.cur.execute('select ts from test')
     ts2 = self.cur.fetchone()[0]
     self.assertEqual(ts, ts2)
Ejemplo n.º 8
0
 def test_date_time_sub_seconds_floating_point(self):
     ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 510241)
     self.cur.execute("insert into test(ts) values (?)", (ts, ))
     self.cur.execute("select ts from test")
     ts2 = self.cur.fetchone()[0]
     self.assertEqual(ts, ts2)
Ejemplo n.º 9
0
 def test_sqlite_timestamp(self):
     ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0)
     self.cur.execute("insert into test(ts) values (?)", (ts, ))
     self.cur.execute("select ts from test")
     ts2 = self.cur.fetchone()[0]
     self.assertEqual(ts, ts2)
Ejemplo n.º 10
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sqlite3 as lite

a = lite.Time(14, 30, 33)
print a, type(a)

b = lite.Timestamp(2013, 5, 3, 16, 33, 10)
print b, type(b)

c = lite.TimeFromTicks(1360090360)
print c, type(c)

d = lite.TimestampFromTicks(1360090360)
print d, type(d)
Ejemplo n.º 11
0
 def test_timestamp(self):
     ts = sqlite.Timestamp(2004, 10, 28, 12, 39, 35)