undefined methods datetime_or_None, date_or_None
(self)
| 13 | |
| 14 | class TestOldIssues(base.PyMySQLTestCase): |
| 15 | def test_issue_3(self): |
| 16 | """undefined methods datetime_or_None, date_or_None""" |
| 17 | conn = self.connect() |
| 18 | c = conn.cursor() |
| 19 | with warnings.catch_warnings(): |
| 20 | warnings.filterwarnings("ignore") |
| 21 | c.execute("drop table if exists issue3") |
| 22 | c.execute("create table issue3 (d date, t time, dt datetime, ts timestamp)") |
| 23 | try: |
| 24 | c.execute( |
| 25 | "insert into issue3 (d, t, dt, ts) values (%s,%s,%s,%s)", |
| 26 | (None, None, None, None), |
| 27 | ) |
| 28 | c.execute("select d from issue3") |
| 29 | self.assertEqual(None, c.fetchone()[0]) |
| 30 | c.execute("select t from issue3") |
| 31 | self.assertEqual(None, c.fetchone()[0]) |
| 32 | c.execute("select dt from issue3") |
| 33 | self.assertEqual(None, c.fetchone()[0]) |
| 34 | c.execute("select ts from issue3") |
| 35 | self.assertIn( |
| 36 | type(c.fetchone()[0]), |
| 37 | (type(None), datetime.datetime), |
| 38 | "expected Python type None or datetime from SQL timestamp", |
| 39 | ) |
| 40 | finally: |
| 41 | c.execute("drop table issue3") |
| 42 | |
| 43 | def test_issue_4(self): |
| 44 | """can't retrieve TIMESTAMP fields""" |