Commit c75a197d authored by Matthew Wilkes's avatar Matthew Wilkes Committed by Jim Fulton

Fix infinite recursion when copying from a MappingStorage to a FileStorage (#199)

parent a6bedf8d
...@@ -344,8 +344,8 @@ class TransactionRecord(object): ...@@ -344,8 +344,8 @@ class TransactionRecord(object):
self.extension = extension self.extension = extension
self.data = data self.data = data
_extension = property(lambda self: self._extension, _extension = property(lambda self: self.extension,
lambda self, v: setattr(self, '_extension', v), lambda self, v: setattr(self, 'extension', v),
) )
def __iter__(self): def __iter__(self):
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
from collections import namedtuple
import ZODB.MappingStorage import ZODB.MappingStorage
import unittest import unittest
import ZODB.tests.hexstorage import ZODB.tests.hexstorage
...@@ -61,9 +62,35 @@ class MappingStorageHexTests(MappingStorageTests): ...@@ -61,9 +62,35 @@ class MappingStorageHexTests(MappingStorageTests):
self._storage = ZODB.tests.hexstorage.HexStorage( self._storage = ZODB.tests.hexstorage.HexStorage(
ZODB.MappingStorage.MappingStorage()) ZODB.MappingStorage.MappingStorage())
MockTransaction = namedtuple(
'transaction',
['user', 'description', 'extension']
)
class MappingStorageTransactionRecordTests(unittest.TestCase):
def setUp(self):
self._transaction_record = ZODB.MappingStorage.TransactionRecord(
0,
MockTransaction('user', 'description', 'extension'),
''
)
def check_set__extension(self):
self._transaction_record._extension = 'new'
self.assertEqual(self._transaction_record.extension, 'new')
def check_get__extension(self):
self.assertEqual(
self._transaction_record.extension,
self._transaction_record._extension
)
def test_suite(): def test_suite():
suite = unittest.makeSuite(MappingStorageTests, 'check') suite = unittest.TestSuite()
suite = unittest.makeSuite(MappingStorageHexTests, 'check') suite.addTest(unittest.makeSuite(MappingStorageTests, 'check'))
suite.addTest(unittest.makeSuite(MappingStorageHexTests, 'check'))
suite.addTest(unittest.makeSuite(MappingStorageTransactionRecordTests, 'check'))
return suite return suite
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment