]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
add test for #2193
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 27 Dec 2011 22:03:53 +0000 (17:03 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 27 Dec 2011 22:03:53 +0000 (17:03 -0500)
test/sql/test_types.py

index 1902c74c28dd2c27fc2b49fc47111059568421b8..793d5cb1259f6f8a8858d0502b080bad7c685a7b 100644 (file)
@@ -364,6 +364,19 @@ class UserDefinedTest(fixtures.TablesTest, AssertsCompiledSQL):
             "MYTYPE foo TWO"
         )
 
+    def test_user_defined_dialect_specific_args(self):
+        class MyType(types.UserDefinedType):
+            def __init__(self, foo='foo', **kwargs):
+                super(MyType, self).__init__()
+                self.foo = foo
+                self.dialect_specific_args = kwargs
+            def adapt(self, cls):
+                return cls(foo=self.foo, **self.dialect_specific_args)
+        t = MyType(bar='bar')
+        a = t.dialect_impl(testing.db.dialect)
+        eq_(a.foo, 'foo')
+        eq_(a.dialect_specific_args['bar'], 'bar')
+
     @testing.provide_metadata
     def test_type_coerce(self):
         """test ad-hoc usage of custom types with type_coerce()."""