Require implementations for warnings.showwarning() support the 'line' argument.
[python.git] / Lib / test / test_buffer.py
blob3bede88bf96b0d97ab5e860e1ed2441d1020ea0f
1 """Unit tests for buffer objects.
3 For now, tests just new or changed functionality.
5 """
7 import unittest
8 from test import test_support
10 class BufferTests(unittest.TestCase):
12 def test_extended_getslice(self):
13 # Test extended slicing by comparing with list slicing.
14 s = "".join(chr(c) for c in list(range(255, -1, -1)))
15 b = buffer(s)
16 indices = (0, None, 1, 3, 19, 300, -1, -2, -31, -300)
17 for start in indices:
18 for stop in indices:
19 # Skip step 0 (invalid)
20 for step in indices[1:]:
21 self.assertEqual(b[start:stop:step],
22 s[start:stop:step])
25 def test_main():
26 test_support.run_unittest(BufferTests)
28 if __name__ == "__main__":
29 test_main()