[Zope-CVS] CVS: Products/AdaptableStorage/tests - testASStorage.py:1.5

Shane Hathaway shane@zope.com
Mon, 6 Jan 2003 09:55:14 -0500


Update of /cvs-repository/Products/AdaptableStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv24827/tests

Modified Files:
	testASStorage.py 
Log Message:
Fixed loading and storage of binary data.  Thanks, Christian Zagrodnick.


=== Products/AdaptableStorage/tests/testASStorage.py 1.4 => 1.5 ===
--- Products/AdaptableStorage/tests/testASStorage.py:1.4	Fri Dec 13 15:42:03 2002
+++ Products/AdaptableStorage/tests/testASStorage.py	Mon Jan  6 09:55:11 2003
@@ -163,7 +163,25 @@
                 conn3.close()
 
 
+    def testStoreAndLoadBinary(self):
+        ob = PersistentMapping()
+        # strdata contains binary characters
+        ob.strdata = ''.join([chr(n) for n in range(256)]) * 2
 
+        dummy = PersistentMapping()
+
+        conn1 = self.db.open()
+        try:
+            root = conn1.root()
+            get_transaction().begin()
+            root['TestRoot'] = ob
+            root['TestRoot2'] = dummy
+            get_transaction().commit()
+            ob1 = conn1.loadStub(('test',))
+            self.assertEqual(ob1.strdata, ob.strdata)
+            self.assertEqual(ob1.items(), ob.items())
+        finally:
+            conn1.close()
 
 
 if __name__ == '__main__':