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

Method test_splitdrive_invalid_paths

Lib/test/test_ntpath.py:134–148  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

132 ("//?/UNC/server/share", "/dir"))
133
134 def test_splitdrive_invalid_paths(self):
135 splitdrive = ntpath.splitdrive
136 self.assertEqual(splitdrive('\\\\ser\x00ver\\sha\x00re\\di\x00r'),
137 ('\\\\ser\x00ver\\sha\x00re', '\\di\x00r'))
138 self.assertEqual(splitdrive(b'\\\\ser\x00ver\\sha\x00re\\di\x00r'),
139 (b'\\\\ser\x00ver\\sha\x00re', b'\\di\x00r'))
140 self.assertEqual(splitdrive("\\\\\udfff\\\udffe\\\udffd"),
141 ('\\\\\udfff\\\udffe', '\\\udffd'))
142 if sys.platform == 'win32':
143 self.assertRaises(UnicodeDecodeError, splitdrive, b'\\\\\xff\\share\\dir')
144 self.assertRaises(UnicodeDecodeError, splitdrive, b'\\\\server\\\xff\\dir')
145 self.assertRaises(UnicodeDecodeError, splitdrive, b'\\\\server\\share\\\xff')
146 else:
147 self.assertEqual(splitdrive(b'\\\\\xff\\\xfe\\\xfd'),
148 (b'\\\\\xff\\\xfe', b'\\\xfd'))
149
150 def test_splitroot(self):
151 tester("ntpath.splitroot('')", ('', '', ''))

Callers

nothing calls this directly

Calls 3

splitdriveFunction · 0.50
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected