]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add doctest to TypeEngine as_generic()
authorAndrew Hannigan <andrewhannigan@Andrews-MacBook-Pro.local>
Mon, 23 Nov 2020 20:59:52 +0000 (14:59 -0600)
committerAndrew Hannigan <andrewhannigan@Andrews-MacBook-Pro.local>
Mon, 23 Nov 2020 20:59:52 +0000 (14:59 -0600)
lib/sqlalchemy/sql/type_api.py

index 6f40f95ecaa3dc0220b1a318674b06ea0e52f9b5..9de93aaed54afc80ca9cd071addb719fafa0b5fa 100644 (file)
@@ -481,7 +481,19 @@ class TypeEngine(Traversible):
         return best_camelcase or best_uppercase or NULLTYPE.__class__
 
     def as_generic(self):
-        """Return an instance of the generic type corresponding to this type"""
+        """
+        Return an instance of the generic type corresponding to this type.
+
+        >>> from sqlalchemy.dialects.mysql import INTEGER
+        >>> INTEGER(display_width=4).as_generic()
+        Integer()
+
+        >>> from sqlalchemy.dialects.mysql import NVARCHAR
+        >>> NVARCHAR(length=100).as_generic()
+        Unicode(length=100)
+
+        .. versionadded:: 1.4.0b2
+        """
 
         return util.constructor_copy(self, self._generic_type_affinity())