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

Method test_as_uri_windows

Lib/test/test_pathlib/test_pathlib.py:761–779  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

759
760 @needs_windows
761 def test_as_uri_windows(self):
762 P = self.cls
763 with self.assertRaises(ValueError):
764 self.make_uri(P('/a/b'))
765 with self.assertRaises(ValueError):
766 self.make_uri(P('c:a/b'))
767 self.assertEqual(self.make_uri(P('c:/')), 'file:///c:/')
768 self.assertEqual(self.make_uri(P('c:/a/b.c')), 'file:///c:/a/b.c')
769 self.assertEqual(self.make_uri(P('c:/a/b%#c')), 'file:///c:/a/b%25%23c')
770 self.assertEqual(self.make_uri(P('//some/share/')), 'file://some/share/')
771 self.assertEqual(self.make_uri(P('//some/share/a/b.c')),
772 'file://some/share/a/b.c')
773
774 from urllib.parse import quote_from_bytes
775 QUOTED_FS_NONASCII = quote_from_bytes(os.fsencode(FS_NONASCII))
776 self.assertEqual(self.make_uri(P('c:/a/b' + FS_NONASCII)),
777 'file:///c:/a/b' + QUOTED_FS_NONASCII)
778 self.assertEqual(self.make_uri(P('//some/share/a/b%#c' + FS_NONASCII)),
779 'file://some/share/a/b%25%23c' + QUOTED_FS_NONASCII)
780
781 @needs_windows
782 def test_ordering_windows(self):

Callers

nothing calls this directly

Calls 5

make_uriMethod · 0.95
quote_from_bytesFunction · 0.90
PClass · 0.70
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected