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

Method test_abspath_invalid_paths

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

Source from the content-addressed store, hash-verified

1246 tester('ntpath.abspath("/abc/")', drive + "\\abc")
1247
1248 def test_abspath_invalid_paths(self):
1249 abspath = ntpath.abspath
1250 if sys.platform == 'win32':
1251 self.assertEqual(abspath("C:\x00"), ntpath.join(abspath("C:"), "\x00"))
1252 self.assertEqual(abspath(b"C:\x00"), ntpath.join(abspath(b"C:"), b"\x00"))
1253 self.assertEqual(abspath("\x00:spam"), "\x00:\\spam")
1254 self.assertEqual(abspath(b"\x00:spam"), b"\x00:\\spam")
1255 self.assertEqual(abspath('c:\\fo\x00o'), 'c:\\fo\x00o')
1256 self.assertEqual(abspath(b'c:\\fo\x00o'), b'c:\\fo\x00o')
1257 self.assertEqual(abspath('c:\\fo\x00o\\..\\bar'), 'c:\\bar')
1258 self.assertEqual(abspath(b'c:\\fo\x00o\\..\\bar'), b'c:\\bar')
1259 self.assertEqual(abspath('c:\\\udfff'), 'c:\\\udfff')
1260 self.assertEqual(abspath('c:\\\udfff\\..\\foo'), 'c:\\foo')
1261 if sys.platform == 'win32':
1262 self.assertRaises(UnicodeDecodeError, abspath, b'c:\\\xff')
1263 self.assertRaises(UnicodeDecodeError, abspath, b'c:\\\xff\\..\\foo')
1264 else:
1265 self.assertEqual(abspath(b'c:\\\xff'), b'c:\\\xff')
1266 self.assertEqual(abspath(b'c:\\\xff\\..\\foo'), b'c:\\foo')
1267
1268 def test_relpath(self):
1269 tester('ntpath.relpath("a")', 'a')

Callers

nothing calls this directly

Calls 4

abspathFunction · 0.70
assertEqualMethod · 0.45
joinMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected