diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-08-04 15:34:24 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-08-04 15:34:24 -0400 |
commit | 757400f82ff079f029cf2e11536c13d6199f832d (patch) | |
tree | 4f80ec9ae7c9a006326b84ae948e2f5bb358ad10 /test/dialect/test_sqlite.py | |
parent | 0eb06660ce838b23e8d12c460f3f322ba3f23ab5 (diff) | |
download | sqlalchemy-757400f82ff079f029cf2e11536c13d6199f832d.tar.gz |
- 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.
Diffstat (limited to 'test/dialect/test_sqlite.py')
-rw-r--r-- | test/dialect/test_sqlite.py | 16 |
1 files changed, 15 insertions, 1 deletions
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') |