Python code coverage for Doc/includes/sqlite3/adapter_datetime.py
# | count | content |
---|---|---|
1 | n/a | import sqlite3 |
2 | n/a | import datetime |
3 | n/a | import time |
4 | n/a | |
5 | n/a | def adapt_datetime(ts): |
6 | n/a | return time.mktime(ts.timetuple()) |
7 | n/a | |
8 | n/a | sqlite3.register_adapter(datetime.datetime, adapt_datetime) |
9 | n/a | |
10 | n/a | con = sqlite3.connect(":memory:") |
11 | n/a | cur = con.cursor() |
12 | n/a | |
13 | n/a | now = datetime.datetime.now() |
14 | n/a | cur.execute("select ?", (now,)) |
15 | n/a | print(cur.fetchone()[0]) |