SVN: ZODB/trunk/src/BTrees/ Added the value class attribute to BTrees.Length.Length.

Albertas Agejevas <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20100204120427.56587941AF__6759.72301182828$1265285080$gmane$org@cvs.zope.org>
Log message for revision 108750:
  Added the value class attribute to BTrees.Length.Length.
  
  Fixes https://bugs.launchpad.net/zodb/+bug/516653 .
  

Changed:
  U   ZODB/trunk/src/BTrees/Length.py
  U   ZODB/trunk/src/BTrees/tests/testLength.py

-=-
Modified: ZODB/trunk/src/BTrees/Length.py
===================================================================
--- ZODB/trunk/src/BTrees/Length.py	2010-02-04 11:08:55 UTC (rev 108749)
+++ ZODB/trunk/src/BTrees/Length.py	2010-02-04 12:04:26 UTC (rev 108750)
@@ -30,6 +30,7 @@
     instance-defined slot fillers are ignored.
 
     """
+    value = 0
 
     def __init__(self, v=0):
         self.value = v

Modified: ZODB/trunk/src/BTrees/tests/testLength.py
===================================================================
--- ZODB/trunk/src/BTrees/tests/testLength.py	2010-02-04 11:08:55 UTC (rev 108749)
+++ ZODB/trunk/src/BTrees/tests/testLength.py	2010-02-04 12:04:26 UTC (rev 108750)
@@ -18,6 +18,7 @@
 __docformat__ = "reStructuredText"
 
 import BTrees.Length
+import copy
 import sys
 import unittest
 
@@ -40,7 +41,13 @@
         length.change(-1)
         self.assertEqual(length(), minint - 1)
         self.assert_(type(length()) is long)
-        
 
+    def test_copy(self):
+        # Test for https://bugs.launchpad.net/zodb/+bug/516653
+        length = BTrees.Length.Length()
+        other = copy.copy(length)
+        self.assertEqual(other(), 0)
+
+
 def test_suite():
     return unittest.makeSuite(LengthTestCase)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.