MCPcopy Index your code
hub / github.com/python/cpython / test_unicode_password

Method test_unicode_password

Lib/test/test_zipfile/test_core.py:2875–2892  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2873 self.assertEqual(self.zip2.read("zero"), self.plain2)
2874
2875 def test_unicode_password(self):
2876 expected_msg = "pwd: expected bytes, got str"
2877
2878 with self.assertRaisesRegex(TypeError, expected_msg):
2879 self.zip.setpassword("unicode")
2880
2881 with self.assertRaisesRegex(TypeError, expected_msg):
2882 self.zip.read("test.txt", "python")
2883
2884 with self.assertRaisesRegex(TypeError, expected_msg):
2885 self.zip.open("test.txt", pwd="python")
2886
2887 with self.assertRaisesRegex(TypeError, expected_msg):
2888 self.zip.extract("test.txt", pwd="python")
2889
2890 with self.assertRaisesRegex(TypeError, expected_msg):
2891 self.zip.pwd = "python"
2892 self.zip.open("test.txt")
2893
2894 def test_seek_tell(self):
2895 self.zip.setpassword(b"python")

Callers

nothing calls this directly

Calls 5

assertRaisesRegexMethod · 0.80
setpasswordMethod · 0.80
readMethod · 0.45
openMethod · 0.45
extractMethod · 0.45

Tested by

no test coverage detected