aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_pathlib/test_pathlib_abc.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-12-12 17:39:24 +0000
committerGitHub <noreply@github.com>2024-12-12 17:39:24 +0000
commit7146f1894638130940944d4808dae7d144d46227 (patch)
treebe8332197a43a5ff0011af924ccd399e4b96c0e0 /Lib/test/test_pathlib/test_pathlib_abc.py
parent487fdbed40734fd7721457c6f6ffeca03da0b0e7 (diff)
downloadcpython-7146f1894638130940944d4808dae7d144d46227.tar.gz
cpython-7146f1894638130940944d4808dae7d144d46227.zip
GH-127807: pathlib ABCs: remove `PathBase._unsupported_msg()` (#127855)
This method helped us customise the `UnsupportedOperation` message depending on the type. But we're aiming to make `PathBase` a proper ABC soon, so `NotImplementedError` is the right exception to raise there.
Diffstat (limited to 'Lib/test/test_pathlib/test_pathlib_abc.py')
-rw-r--r--Lib/test/test_pathlib/test_pathlib_abc.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/test/test_pathlib/test_pathlib_abc.py b/Lib/test/test_pathlib/test_pathlib_abc.py
index d770b87dc6a..e230dd18879 100644
--- a/Lib/test/test_pathlib/test_pathlib_abc.py
+++ b/Lib/test/test_pathlib/test_pathlib_abc.py
@@ -5,7 +5,7 @@ import errno
import stat
import unittest
-from pathlib._abc import UnsupportedOperation, PurePathBase, PathBase
+from pathlib._abc import PurePathBase, PathBase
from pathlib._types import Parser
import posixpath
@@ -27,11 +27,6 @@ def needs_windows(fn):
return fn
-class UnsupportedOperationTest(unittest.TestCase):
- def test_is_notimplemented(self):
- self.assertTrue(issubclass(UnsupportedOperation, NotImplementedError))
- self.assertTrue(isinstance(UnsupportedOperation(), NotImplementedError))
-
#
# Tests for the pure classes.
#
@@ -1294,10 +1289,9 @@ class DummyPurePathTest(unittest.TestCase):
class PathBaseTest(PurePathBaseTest):
cls = PathBase
- def test_unsupported_operation(self):
- P = self.cls
+ def test_not_implemented_error(self):
p = self.cls('')
- e = UnsupportedOperation
+ e = NotImplementedError
self.assertRaises(e, p.stat)
self.assertRaises(e, p.exists)
self.assertRaises(e, p.is_dir)