summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/test/regression.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sqlite3/test/regression.py')
-rw-r--r--Lib/sqlite3/test/regression.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py
index 87d2cce..5e2fbf9 100644
--- a/Lib/sqlite3/test/regression.py
+++ b/Lib/sqlite3/test/regression.py
@@ -313,11 +313,20 @@ class RegressionTests(unittest.TestCase):
con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES)
cur = con.cursor()
cur.execute("CREATE TABLE t (x TIMESTAMP)")
+
+ # Microseconds should be 456000
cur.execute("INSERT INTO t (x) VALUES ('2012-04-04 15:06:00.456')")
+
+ # Microseconds should be truncated to 123456
+ cur.execute("INSERT INTO t (x) VALUES ('2012-04-04 15:06:00.123456789')")
+
cur.execute("SELECT * FROM t")
- date = cur.fetchall()[0][0]
+ values = [x[0] for x in cur.fetchall()]
- self.assertEqual(date, datetime.datetime(2012, 4, 4, 15, 6, 0, 456000))
+ self.assertEqual(values, [
+ datetime.datetime(2012, 4, 4, 15, 6, 0, 456000),
+ datetime.datetime(2012, 4, 4, 15, 6, 0, 123456),
+ ])
def suite():