type class as an argument which is internally converted to an
instance, using the same convention long established by other
constructs such as :class:`.Column`. fixes #3122
:version: 0.9.7
:released:
+ .. change::
+ :tags: bug, sql
+ :tickets: 3122
+
+ The :meth:`.TypeEngine.with_variant` method will now accept a
+ type class as an argument which is internally converted to an
+ instance, using the same convention long established by other
+ constructs such as :class:`.Column`.
+
.. change::
:tags: bug, orm
:tickets: 3117
.. versionadded:: 0.7.2
"""
- return Variant(self, {dialect_name: type_})
+ return Variant(self, {dialect_name: to_instance(type_)})
@util.memoized_property
dialect=dialects.postgresql.dialect()
)
+ def test_to_instance(self):
+ self.assert_compile(
+ self.UTypeOne().with_variant(self.UTypeTwo, "postgresql"),
+ "UTYPETWO",
+ dialect=dialects.postgresql.dialect()
+ )
+
def test_compile_composite(self):
self.assert_compile(
self.composite,