diff options
author | Raymond Hettinger <python@rcn.com> | 2009-03-10 12:50:59 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-03-10 12:50:59 (GMT) |
commit | 56411aac79ee3c55ce11cea55ec7921f5d96654a (patch) | |
tree | fe5e9cb2f5198b71e991f64a13345cb0952dc2a8 /Lib/test/test_deque.py | |
parent | bac769bb5e7656c65e75e27c9d4c914b5d98f12c (diff) | |
download | cpython-56411aac79ee3c55ce11cea55ec7921f5d96654a.zip cpython-56411aac79ee3c55ce11cea55ec7921f5d96654a.tar.gz cpython-56411aac79ee3c55ce11cea55ec7921f5d96654a.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 dcef246..a68d014 100644 --- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -104,6 +104,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)]: |