diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-02-02 10:37:15 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-02-02 10:37:15 (GMT) |
commit | 275bd96aa67ce2bf1c1f57cb5c2cb840d3afbb2d (patch) | |
tree | 550384d874614b8056facdc1e354f2fb762ee6e6 /Lib/test/buffer_tests.py | |
parent | 3464ea2807b6ba2d132ef27b65535116ab993eba (diff) | |
download | cpython-275bd96aa67ce2bf1c1f57cb5c2cb840d3afbb2d.zip cpython-275bd96aa67ce2bf1c1f57cb5c2cb840d3afbb2d.tar.gz cpython-275bd96aa67ce2bf1c1f57cb5c2cb840d3afbb2d.tar.bz2 |
Issue #19587: Remove masked and redundant tests in test_bytes
* test_contains() did not override anything
* test_expandtabs/upper/lower() in FixedStringTest were masking usable tests
in string_tests. These tests now get run for bytearray() and bytes().
* test_expandtabs/upper/lower() in buffer_tests were only run on bytearray()
and are redundant with string_tests
Diffstat (limited to 'Lib/test/buffer_tests.py')
-rw-r--r-- | Lib/test/buffer_tests.py | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/Lib/test/buffer_tests.py b/Lib/test/buffer_tests.py index 0a62940..8bef7e8 100644 --- a/Lib/test/buffer_tests.py +++ b/Lib/test/buffer_tests.py @@ -1,11 +1,8 @@ -# Tests that work for both bytes and buffer objects. +# Tests that work for bytearray objects. Could be merged into string_tests. # See PEP 3137. -import struct -import sys - class MixinBytesBufferCommonTests(object): - """Tests that work for both bytes and buffer objects. + """Tests that work for bytearray objects. See PEP 3137. """ @@ -88,16 +85,6 @@ class MixinBytesBufferCommonTests(object): self.assertRaises(TypeError, self.marshal(b'abc').isdigit, 42) - def test_lower(self): - self.assertEqual(b'hello', self.marshal(b'HeLLo').lower()) - self.assertEqual(b'hello', self.marshal(b'hello').lower()) - self.assertRaises(TypeError, self.marshal(b'hello').lower, 42) - - def test_upper(self): - self.assertEqual(b'HELLO', self.marshal(b'HeLLo').upper()) - self.assertEqual(b'HELLO', self.marshal(b'HELLO').upper()) - self.assertRaises(TypeError, self.marshal(b'hello').upper, 42) - def test_capitalize(self): self.assertEqual(b' hello ', self.marshal(b' hello ').capitalize()) self.assertEqual(b'Hello ', self.marshal(b'Hello ').capitalize()) @@ -153,35 +140,6 @@ class MixinBytesBufferCommonTests(object): self.assertRaises(TypeError, self.marshal(b'123').zfill) - def test_expandtabs(self): - self.assertEqual(b'abc\rab def\ng hi', - self.marshal(b'abc\rab\tdef\ng\thi').expandtabs()) - self.assertEqual(b'abc\rab def\ng hi', - self.marshal(b'abc\rab\tdef\ng\thi').expandtabs(8)) - self.assertEqual(b'abc\rab def\ng hi', - self.marshal(b'abc\rab\tdef\ng\thi').expandtabs(4)) - self.assertEqual(b'abc\r\nab def\ng hi', - self.marshal(b'abc\r\nab\tdef\ng\thi').expandtabs()) - self.assertEqual(b'abc\r\nab def\ng hi', - self.marshal(b'abc\r\nab\tdef\ng\thi').expandtabs(8)) - self.assertEqual(b'abc\r\nab def\ng hi', - self.marshal(b'abc\r\nab\tdef\ng\thi').expandtabs(4)) - self.assertEqual(b'abc\r\nab\r\ndef\ng\r\nhi', - self.marshal(b'abc\r\nab\r\ndef\ng\r\nhi').expandtabs(4)) - # check keyword args - self.assertEqual(b'abc\rab def\ng hi', - self.marshal(b'abc\rab\tdef\ng\thi').expandtabs(tabsize=8)) - self.assertEqual(b'abc\rab def\ng hi', - self.marshal(b'abc\rab\tdef\ng\thi').expandtabs(tabsize=4)) - - self.assertEqual(b' a\n b', self.marshal(b' \ta\n\tb').expandtabs(1)) - - self.assertRaises(TypeError, self.marshal(b'hello').expandtabs, 42, 42) - # This test is only valid when sizeof(int) == sizeof(void*) == 4. - if sys.maxsize < (1 << 32) and struct.calcsize('P') == 4: - self.assertRaises(OverflowError, - self.marshal(b'\ta\n\tb').expandtabs, sys.maxsize) - def test_title(self): self.assertEqual(b' Hello ', self.marshal(b' hello ').title()) self.assertEqual(b'Hello ', self.marshal(b'hello ').title()) |