MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_div

Method test_div

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

Source from the content-addressed store, hash-verified

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