cpython: 8545a082fcaa (original) (raw)

Mercurial > cpython

changeset 100136:8545a082fcaa

Issue #19587: Merge test_bytes cleanup from 3.5 [#19587]

Martin Panter vadmium+py@gmail.com
date Tue, 02 Feb 2016 10:54:10 +0000
parents 3b211ee66b82(current diff)22c2dd04a3d3(diff)
children fb192db73ab1
files Lib/test/test_bytes.py
diffstat 3 files changed, 6 insertions(+), 63 deletions(-)[+] [-] Lib/test/buffer_tests.py 46 Lib/test/string_tests.py 10 Lib/test/test_bytes.py 13

line wrap: on

line diff

--- 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):

-

- 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_title(self): self.assertEqual(b' Hello ', self.marshal(b' hello ').title()) self.assertEqual(b'Hello ', self.marshal(b'hello ').title())

--- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -1,5 +1,5 @@ """ -Common tests shared by test_unicode, test_userstring and test_string. +Common tests shared by test_unicode, test_userstring and test_bytes. """ import unittest, string, sys, struct @@ -686,8 +686,7 @@ class BaseTest: class CommonTest(BaseTest): # This testcase contains tests that can be used in all

def test_hash(self): # SF bug 1054139: += optimization was not invalidating cached hash value @@ -857,8 +856,7 @@ class CommonTest(BaseTest): class MixinStrUnicodeUserStringTest: # additional tests that only work for

def test_islower(self): self.checkequal(False, '', 'islower') @@ -1343,7 +1341,7 @@ class MixinStrUnicodeUserStringTest: class MixinStrUnicodeTest:

def test_bug1001011(self): # Make sure join returns a NEW object for single item sequences

--- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -1562,24 +1562,11 @@ class BytearrayPEP3137Test(unittest.Test class FixedStringTest(test.string_tests.BaseTest): - def fixtype(self, obj): if isinstance(obj, str): return obj.encode("utf-8") return super().fixtype(obj)

- class ByteArrayAsStringTest(FixedStringTest, unittest.TestCase): type2test = bytearray contains_bytes = True