(self)
| 16 | |
| 17 | class JoinTestBase: |
| 18 | def test_join(self): |
| 19 | P = self.cls |
| 20 | p = P('C:/a/b') |
| 21 | pp = p.joinpath('x/y') |
| 22 | self.assertEqual(pp, P(r'C:/a/b\x/y')) |
| 23 | pp = p.joinpath('/x/y') |
| 24 | self.assertEqual(pp, P('C:/x/y')) |
| 25 | # Joining with a different drive => the first path is ignored, even |
| 26 | # if the second path is relative. |
| 27 | pp = p.joinpath('D:x/y') |
| 28 | self.assertEqual(pp, P('D:x/y')) |
| 29 | pp = p.joinpath('D:/x/y') |
| 30 | self.assertEqual(pp, P('D:/x/y')) |
| 31 | pp = p.joinpath('//host/share/x/y') |
| 32 | self.assertEqual(pp, P('//host/share/x/y')) |
| 33 | # Joining with the same drive => the first path is appended to if |
| 34 | # the second path is relative. |
| 35 | pp = p.joinpath('c:x/y') |
| 36 | self.assertEqual(pp, P(r'c:/a/b\x/y')) |
| 37 | pp = p.joinpath('c:/x/y') |
| 38 | self.assertEqual(pp, P('c:/x/y')) |
| 39 | # Joining with files with NTFS data streams => the filename should |
| 40 | # not be parsed as a drive letter |
| 41 | pp = p.joinpath('./d:s') |
| 42 | self.assertEqual(pp, P(r'C:/a/b\./d:s')) |
| 43 | pp = p.joinpath('./dd:s') |
| 44 | self.assertEqual(pp, P(r'C:/a/b\./dd:s')) |
| 45 | pp = p.joinpath('E:d:s') |
| 46 | self.assertEqual(pp, P('E:d:s')) |
| 47 | # Joining onto a UNC path with no root |
| 48 | pp = P('//server').joinpath('share') |
| 49 | self.assertEqual(pp, P(r'//server\share')) |
| 50 | pp = P('//./BootPartition').joinpath('Windows') |
| 51 | self.assertEqual(pp, P(r'//./BootPartition\Windows')) |
| 52 | |
| 53 | def test_div(self): |
| 54 | # Basically the same as joinpath(). |
nothing calls this directly
no test coverage detected