Skip to content

Commit 003764f

Browse files
miss-islingtonravg998tomasr8
authored
[3.15] Test that ValueError is raised when vfsopen is passed an invalid mode (GH-154008) (#154064)
Test that `ValueError` is raised when `vfsopen` is passed an invalid mode (GH-154008) * ValueError with message test * Remove white space * Apply suggestions from code review Change from double quotes to single quotes. --------- (cherry picked from commit 9f5af27) Co-authored-by: Rayan <157278782+ravg998@users.noreply.github.com> Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
1 parent b51ecd8 commit 003764f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Lib/test/test_pathlib/test_read.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,11 @@ def test_info_is_symlink(self):
329329
self.assertFalse((p / 'fileA\udfff').info.is_symlink())
330330
self.assertFalse((p / 'fileA\x00').info.is_symlink())
331331

332+
def test_invalid_mode(self):
333+
p = self.root / 'fileA'
334+
with self.assertRaisesRegex(ValueError, 'invalid mode'):
335+
vfsopen(p, 'q')
336+
332337

333338
class ZipPathReadTest(ReadTestBase, unittest.TestCase):
334339
ground = ZipPathGround(ReadableZipPath)

0 commit comments

Comments
 (0)