Commit 7d360485 authored by Albertas Agejevas's avatar Albertas Agejevas

Added the value class attribute to BTrees.Length.Length.

Fixes https://bugs.launchpad.net/zodb/+bug/516653 .
parent 6b57dd89
...@@ -30,6 +30,7 @@ class Length(persistent.Persistent): ...@@ -30,6 +30,7 @@ class Length(persistent.Persistent):
instance-defined slot fillers are ignored. instance-defined slot fillers are ignored.
""" """
value = 0
def __init__(self, v=0): def __init__(self, v=0):
self.value = v self.value = v
......
...@@ -18,6 +18,7 @@ Test for BTrees.Length module. ...@@ -18,6 +18,7 @@ Test for BTrees.Length module.
__docformat__ = "reStructuredText" __docformat__ = "reStructuredText"
import BTrees.Length import BTrees.Length
import copy
import sys import sys
import unittest import unittest
...@@ -41,6 +42,12 @@ class LengthTestCase(unittest.TestCase): ...@@ -41,6 +42,12 @@ class LengthTestCase(unittest.TestCase):
self.assertEqual(length(), minint - 1) self.assertEqual(length(), minint - 1)
self.assert_(type(length()) is long) 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(): def test_suite():
return unittest.makeSuite(LengthTestCase) return unittest.makeSuite(LengthTestCase)
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