summaryrefslogtreecommitdiff
path: root/test/base/utils.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-03-19 18:02:47 +0000
committerJason Kirtland <jek@discorporate.us>2008-03-19 18:02:47 +0000
commita86dc8cbac51893e400e9e49f5e9d358c9845897 (patch)
tree0a1aaf7495f574fef153df58c8a813e0718c3ecd /test/base/utils.py
parentfb9f459d712a70478d30978b8fe84edc4c072f74 (diff)
downloadsqlalchemy-a86dc8cbac51893e400e9e49f5e9d358c9845897.tar.gz
- symbols now depickle properly
- fixed some symbol __new__ abuse
Diffstat (limited to 'test/base/utils.py')
-rw-r--r--test/base/utils.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/base/utils.py b/test/base/utils.py
index 6ab141d6c..fc72cf8e1 100644
--- a/test/base/utils.py
+++ b/test/base/utils.py
@@ -389,5 +389,36 @@ class ArgInspectionTest(TestBase):
test(f3)
test(f4)
+class SymbolTest(TestBase):
+ def test_basic(self):
+ sym1 = util.symbol('foo')
+ assert sym1.name == 'foo'
+ sym2 = util.symbol('foo')
+
+ assert sym1 is sym2
+ assert sym1 == sym2
+
+ sym3 = util.symbol('bar')
+ assert sym1 is not sym3
+ assert sym1 != sym3
+
+ def test_pickle(self):
+ sym1 = util.symbol('foo')
+ sym2 = util.symbol('foo')
+
+ assert sym1 is sym2
+
+ # default
+ s = util.pickle.dumps(sym1)
+ sym3 = util.pickle.loads(s)
+
+ for protocol in 0, 1, 2:
+ print protocol
+ serial = util.pickle.dumps(sym1)
+ rt = util.pickle.loads(serial)
+ assert rt is sym1
+ assert rt is sym2
+
+
if __name__ == "__main__":
testenv.main()