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

Method test_splitroot_invalid_paths

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

Source from the content-addressed store, hash-verified

238 tester('ntpath.splitroot("/:/foo")', ("", "/", ":/foo"))
239
240 def test_splitroot_invalid_paths(self):
241 splitroot = ntpath.splitroot
242 self.assertEqual(splitroot('\\\\ser\x00ver\\sha\x00re\\di\x00r'),
243 ('\\\\ser\x00ver\\sha\x00re', '\\', 'di\x00r'))
244 self.assertEqual(splitroot(b'\\\\ser\x00ver\\sha\x00re\\di\x00r'),
245 (b'\\\\ser\x00ver\\sha\x00re', b'\\', b'di\x00r'))
246 self.assertEqual(splitroot("\\\\\udfff\\\udffe\\\udffd"),
247 ('\\\\\udfff\\\udffe', '\\', '\udffd'))
248 if sys.platform == 'win32':
249 self.assertRaises(UnicodeDecodeError, splitroot, b'\\\\\xff\\share\\dir')
250 self.assertRaises(UnicodeDecodeError, splitroot, b'\\\\server\\\xff\\dir')
251 self.assertRaises(UnicodeDecodeError, splitroot, b'\\\\server\\share\\\xff')
252 else:
253 self.assertEqual(splitroot(b'\\\\\xff\\\xfe\\\xfd'),
254 (b'\\\\\xff\\\xfe', b'\\', b'\xfd'))
255
256 def test_split(self):
257 tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))

Callers

nothing calls this directly

Calls 3

splitrootFunction · 0.50
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected