gh-71339: Use new assertion methods in tests (GH-129046)

This commit is contained in:
Serhiy Storchaka 2025-05-22 13:17:22 +03:00 committed by GitHub
parent bb244fd33d
commit 2602d8ae98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
117 changed files with 407 additions and 445 deletions

View file

@ -77,8 +77,8 @@ def needs_symlinks(fn):
class UnsupportedOperationTest(unittest.TestCase):
def test_is_notimplemented(self):
self.assertTrue(issubclass(pathlib.UnsupportedOperation, NotImplementedError))
self.assertTrue(isinstance(pathlib.UnsupportedOperation(), NotImplementedError))
self.assertIsSubclass(pathlib.UnsupportedOperation, NotImplementedError)
self.assertIsInstance(pathlib.UnsupportedOperation(), NotImplementedError)
class LazyImportTest(unittest.TestCase):
@ -300,8 +300,8 @@ def test_repr_common(self):
clsname = p.__class__.__name__
r = repr(p)
# The repr() is in the form ClassName("forward-slashes path").
self.assertTrue(r.startswith(clsname + '('), r)
self.assertTrue(r.endswith(')'), r)
self.assertStartsWith(r, clsname + '(')
self.assertEndsWith(r, ')')
inner = r[len(clsname) + 1 : -1]
self.assertEqual(eval(inner), p.as_posix())