mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.14] gh-71339: Use new assertion methods in tests (GH-129046) (GH-134498)
(cherry picked from commit 2602d8ae98
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
d5f7e80d44
commit
db98e0bb12
117 changed files with 407 additions and 445 deletions
|
@ -1974,9 +1974,9 @@ class AssortedBytesTest(unittest.TestCase):
|
|||
@test.support.requires_docstrings
|
||||
def test_doc(self):
|
||||
self.assertIsNotNone(bytearray.__doc__)
|
||||
self.assertTrue(bytearray.__doc__.startswith("bytearray("), bytearray.__doc__)
|
||||
self.assertStartsWith(bytearray.__doc__, "bytearray(")
|
||||
self.assertIsNotNone(bytes.__doc__)
|
||||
self.assertTrue(bytes.__doc__.startswith("bytes("), bytes.__doc__)
|
||||
self.assertStartsWith(bytes.__doc__, "bytes(")
|
||||
|
||||
def test_from_bytearray(self):
|
||||
sample = bytes(b"Hello world\n\x80\x81\xfe\xff")
|
||||
|
@ -2107,7 +2107,7 @@ class BytesAsStringTest(FixedStringTest, unittest.TestCase):
|
|||
class SubclassTest:
|
||||
|
||||
def test_basic(self):
|
||||
self.assertTrue(issubclass(self.type2test, self.basetype))
|
||||
self.assertIsSubclass(self.type2test, self.basetype)
|
||||
self.assertIsInstance(self.type2test(), self.basetype)
|
||||
|
||||
a, b = b"abcd", b"efgh"
|
||||
|
@ -2155,7 +2155,7 @@ class SubclassTest:
|
|||
self.assertEqual(a.z, b.z)
|
||||
self.assertEqual(type(a), type(b))
|
||||
self.assertEqual(type(a.z), type(b.z))
|
||||
self.assertFalse(hasattr(b, 'y'))
|
||||
self.assertNotHasAttr(b, 'y')
|
||||
|
||||
def test_copy(self):
|
||||
a = self.type2test(b"abcd")
|
||||
|
@ -2169,7 +2169,7 @@ class SubclassTest:
|
|||
self.assertEqual(a.z, b.z)
|
||||
self.assertEqual(type(a), type(b))
|
||||
self.assertEqual(type(a.z), type(b.z))
|
||||
self.assertFalse(hasattr(b, 'y'))
|
||||
self.assertNotHasAttr(b, 'y')
|
||||
|
||||
def test_fromhex(self):
|
||||
b = self.type2test.fromhex('1a2B30')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue