From 757400f82ff079f029cf2e11536c13d6199f832d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 4 Aug 2011 15:34:24 -0400 Subject: - Ensured that the same ValueError is raised for illegal date/time/datetime string parsed from the database regardless of whether C extensions are in use or not. --- test/dialect/test_sqlite.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test/dialect/test_sqlite.py') diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index f3422cf0e..c4748500a 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -44,11 +44,25 @@ class TestTypes(fixtures.TestBase, AssertsExecutionResults): finally: meta.drop_all() - def test_string_dates_raise(self): + def test_string_dates_passed_raise(self): assert_raises(exc.StatementError, testing.db.execute, select([1]).where(bindparam('date', type_=Date)), date=str(datetime.date(2007, 10, 30))) + def test_cant_parse_datetime_message(self): + for (typ, disp) in [ + (Time, "time"), + (DateTime, "datetime"), + (Date, "date") + ]: + assert_raises_message( + ValueError, + "Couldn't parse %s string." % disp, + lambda: testing.db.execute( + text("select 'ASDF' as value", typemap={"value":typ}) + ).scalar() + ) + def test_time_microseconds(self): dt = datetime.datetime(2008, 6, 27, 12, 0, 0, 125, ) eq_(str(dt), '2008-06-27 12:00:00.000125') -- cgit v1.2.1