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

Method test_invalid_modes

Lib/test/test_codecs.py:729–739  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

727 self.assertEqual(reader.read(), s1)
728
729 def test_invalid_modes(self):
730 for mode in ('U', 'rU', 'r+U'):
731 with self.assertRaises(ValueError) as cm:
732 codecs_open_no_warn(os_helper.TESTFN, mode, encoding=self.encoding)
733 self.assertIn('invalid mode', str(cm.exception))
734
735 for mode in ('rt', 'wt', 'at', 'r+t'):
736 with self.assertRaises(ValueError) as cm:
737 codecs_open_no_warn(os_helper.TESTFN, mode, encoding=self.encoding)
738 self.assertIn("can't have text and binary mode at once",
739 str(cm.exception))
740
741
742class UTF16LETest(ReadTest, unittest.TestCase):

Callers

nothing calls this directly

Calls 4

codecs_open_no_warnFunction · 0.85
strFunction · 0.85
assertInMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected