summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-04-29 16:12:02 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-04-29 16:12:02 +0000
commit337d3b268562f421b6bb0e445c6f2ba187514a4b (patch)
treea15873c9c7d712d8727dfe21bf728d5f1516f4d1 /test
parent4cff2c1a3c6600376f2ce09692df233928a9f4f7 (diff)
downloadsqlalchemy-337d3b268562f421b6bb0e445c6f2ba187514a4b.tar.gz
more work on types. this is the simplest implementation which is a little more manual
Diffstat (limited to 'test')
-rw-r--r--test/testtypes.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/testtypes.py b/test/testtypes.py
index 3903b3a81..2fb41cc79 100644
--- a/test/testtypes.py
+++ b/test/testtypes.py
@@ -14,8 +14,6 @@ class MyType(types.TypeEngine):
return value + "BIND_OUT"
def adapt(self, typeobj):
return typeobj()
- def adapt_args(self):
- return self
class MyDecoratedType(types.TypeDecorator):
impl = String
@@ -23,12 +21,16 @@ class MyDecoratedType(types.TypeDecorator):
return "BIND_IN"+ value
def convert_result_value(self, value, engine):
return value + "BIND_OUT"
-
+ def copy(self):
+ return MyDecoratedType()
+
class MyUnicodeType(types.Unicode):
def convert_bind_param(self, value, engine):
return "UNI_BIND_IN"+ value
def convert_result_value(self, value, engine):
return value + "UNI_BIND_OUT"
+ def copy(self):
+ return MyUnicodeType(self.impl.length)
class AdaptTest(PersistTest):
def testadapt(self):
@@ -44,6 +46,15 @@ class AdaptTest(PersistTest):
assert t1 != t2
assert t2 != t3
assert t3 != t1
+
+ def testdecorator(self):
+ t1 = Unicode(20)
+ t2 = Unicode()
+ assert isinstance(t1.impl, String)
+ assert not isinstance(t1.impl, TEXT)
+ assert (t1.impl.length == 20)
+ assert isinstance(t2.impl, TEXT)
+ assert t2.impl.length is None
class OverrideTest(PersistTest):
"""tests user-defined types, including a full type as well as a TypeDecorator"""