From: Rayan <157278782+ravg998@users.noreply.github.com> Date: Sun, 19 Jul 2026 08:21:26 +0000 (+0200) Subject: Test that `ValueError` is raised when `vfsopen` is passed an invalid mode (#154008) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f5af278960a2f73a2e070de5141701e72675cf6;p=thirdparty%2FPython%2Fcpython.git Test that `ValueError` is raised when `vfsopen` is passed an invalid mode (#154008) * ValueError with message test * Remove white space * Apply suggestions from code review Change from double quotes to single quotes. Co-authored-by: Tomas R. --------- Co-authored-by: Tomas R. --- diff --git a/Lib/test/test_pathlib/test_read.py b/Lib/test/test_pathlib/test_read.py index 16fb555b2aee..51eede9d9eba 100644 --- a/Lib/test/test_pathlib/test_read.py +++ b/Lib/test/test_pathlib/test_read.py @@ -329,6 +329,11 @@ class ReadTestBase: self.assertFalse((p / 'fileA\udfff').info.is_symlink()) self.assertFalse((p / 'fileA\x00').info.is_symlink()) + def test_invalid_mode(self): + p = self.root / 'fileA' + with self.assertRaisesRegex(ValueError, 'invalid mode'): + vfsopen(p, 'q') + class ZipPathReadTest(ReadTestBase, unittest.TestCase): ground = ZipPathGround(ReadableZipPath)