diff options
author | Raymond Hettinger <python@rcn.com> | 2009-03-10 12:56:32 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-03-10 12:56:32 (GMT) |
commit | 5bb0f0e072ef22fa16bf281bc5e6b5d7a1594beb (patch) | |
tree | 1621e012d8d1ad69a2afe5f9bc17cdbb815466f4 /Lib/test/test_deque.py | |
parent | 060c7f6bbafdaeb4b73ce34f1bb34e4ac76f2d92 (diff) | |
download | cpython-5bb0f0e072ef22fa16bf281bc5e6b5d7a1594beb.zip cpython-5bb0f0e072ef22fa16bf281bc5e6b5d7a1594beb.tar.gz cpython-5bb0f0e072ef22fa16bf281bc5e6b5d7a1594beb.tar.bz2 |
For collections.deque() objects, expose the maxlen parameter as a read-only attribute.
Diffstat (limited to 'Lib/test/test_deque.py')
-rw-r--r-- | Lib/test/test_deque.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py index a9e010e..fab5a7c 100644 --- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -105,6 +105,16 @@ class TestBasic(unittest.TestCase): d.extendleft(it) self.assertEqual(list(it), []) + def test_maxlen_attribute(self): + self.assertEqual(deque().maxlen, None) + self.assertEqual(deque('abc').maxlen, None) + self.assertEqual(deque('abc', maxlen=4).maxlen, 4) + self.assertEqual(deque('abc', maxlen=2).maxlen, 2) + self.assertEqual(deque('abc', maxlen=0).maxlen, 0) + with self.assertRaises(AttributeError): + d = deque('abc') + d.maxlen = 10 + def test_comparisons(self): d = deque('xabc'); d.popleft() for e in [d, deque('abc'), deque('ab'), deque(), list(d)]: |