summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_buffer.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_buffer.py')
-rw-r--r--Lib/test/test_buffer.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
index eb6e9ea..834c05b 100644
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -37,6 +37,18 @@ class BufferTests(unittest.TestCase):
self.failIf(a == b)
self.assertRaises(TypeError, lambda: a < b)
+ def test_extended_getslice(self):
+ # Test extended slicing by comparing with list slicing.
+ s = bytes(range(255, -1, -1))
+ b = buffer(s)
+ indices = (0, None, 1, 3, 19, 300, -1, -2, -31, -300)
+ for start in indices:
+ for stop in indices:
+ # Skip step 0 (invalid)
+ for step in indices[1:]:
+ self.assertEqual(b[start:stop:step],
+ s[start:stop:step])
+
def test_main():
test_support.run_unittest(BufferTests)