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

Method test_div

Lib/test/test_pathlib/test_join_windows.py:53–76  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

51 self.assertEqual(pp, P(r'//./BootPartition\Windows'))
52
53 def test_div(self):
54 # Basically the same as joinpath().
55 P = self.cls
56 p = P('C:/a/b')
57 self.assertEqual(p / 'x/y', P(r'C:/a/b\x/y'))
58 self.assertEqual(p / 'x' / 'y', P(r'C:/a/b\x\y'))
59 self.assertEqual(p / '/x/y', P('C:/x/y'))
60 self.assertEqual(p / '/x' / 'y', P(r'C:/x\y'))
61 # Joining with a different drive => the first path is ignored, even
62 # if the second path is relative.
63 self.assertEqual(p / 'D:x/y', P('D:x/y'))
64 self.assertEqual(p / 'D:' / 'x/y', P('D:x/y'))
65 self.assertEqual(p / 'D:/x/y', P('D:/x/y'))
66 self.assertEqual(p / 'D:' / '/x/y', P('D:/x/y'))
67 self.assertEqual(p / '//host/share/x/y', P('//host/share/x/y'))
68 # Joining with the same drive => the first path is appended to if
69 # the second path is relative.
70 self.assertEqual(p / 'c:x/y', P(r'c:/a/b\x/y'))
71 self.assertEqual(p / 'c:/x/y', P('c:/x/y'))
72 # Joining with files with NTFS data streams => the filename should
73 # not be parsed as a drive letter
74 self.assertEqual(p / './d:s', P(r'C:/a/b\./d:s'))
75 self.assertEqual(p / './dd:s', P(r'C:/a/b\./dd:s'))
76 self.assertEqual(p / 'E:d:s', P('E:d:s'))
77
78 def test_vfspath(self):
79 p = self.cls(r'a\b\c')

Callers

nothing calls this directly

Calls 2

PClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected