summaryrefslogtreecommitdiff
path: root/test/dialect/mysql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-02-19 15:49:37 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-02-19 15:49:37 -0500
commita552606091bf84579751cd80ca458a0483b2b96a (patch)
tree49ea3a1a352bd6a4f70ca0a52b1d950342a11aef /test/dialect/mysql
parent0b4c0384f60f35c8fb6fa0ffc521f83cc4b9d46e (diff)
downloadsqlalchemy-a552606091bf84579751cd80ca458a0483b2b96a.tar.gz
- Added new MySQL-specific :class:`.mysql.DATETIME` which includes
fractional seconds support; also added fractional seconds support to :class:`.mysql.TIMESTAMP`. DBAPI support is limited, though fractional seconds are known to be supported by MySQL Connector/Python. Patch courtesy Geert JM Vanderkelen. #2941
Diffstat (limited to 'test/dialect/mysql')
-rw-r--r--test/dialect/mysql/test_types.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/test/dialect/mysql/test_types.py b/test/dialect/mysql/test_types.py
index acf9c1e2f..a0549e374 100644
--- a/test/dialect/mysql/test_types.py
+++ b/test/dialect/mysql/test_types.py
@@ -408,8 +408,14 @@ class TypesTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
roundtrip([False, False, 0, 0, 0], [False, False, False,
False, 0])
- def test_timestamp(self):
- """Exercise funky TIMESTAMP default syntax."""
+ def test_timestamp_fsp(self):
+ self.assert_compile(
+ mysql.TIMESTAMP(fsp=5),
+ "TIMESTAMP(5)"
+ )
+
+ def test_timestamp_defaults(self):
+ """Exercise funky TIMESTAMP default syntax when used in columns."""
columns = [
([TIMESTAMP],
@@ -473,7 +479,20 @@ class TypesTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
[(now, now), (None, now)]
)
- def test_time(self):
+ def test_datetime_generic(self):
+ self.assert_compile(
+ mysql.DATETIME(),
+ "DATETIME"
+ )
+
+ def test_datetime_fsp(self):
+ self.assert_compile(
+ mysql.DATETIME(fsp=4),
+ "DATETIME(4)"
+ )
+
+
+ def test_time_generic(self):
""""Exercise TIME."""
self.assert_compile(
@@ -481,11 +500,13 @@ class TypesTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
"TIME"
)
+ def test_time_fsp(self):
self.assert_compile(
mysql.TIME(fsp=5),
"TIME(5)"
)
+ def test_time_result_processor(self):
eq_(
mysql.TIME().result_processor(None, None)(
datetime.timedelta(seconds=35, minutes=517,