Size: 750 bytes.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
# cs/q/simplify_path/simplify_path_test.py
import unittest
from simplify_path import SimplifyPath


class TestSimplifyPath(unittest.TestCase):
    def test_example1(self):
        self.assertEqual(SimplifyPath("/home/"), "/home")

    def test_example2(self):
        self.assertEqual(SimplifyPath("/home//foo/"), "/home/foo")

    def test_example3(self):
        self.assertEqual(
            SimplifyPath("/home/user/Documents/../Pictures"),
            "/home/user/Pictures",
        )

    def test_example4(self):
        self.assertEqual(SimplifyPath("/../"), "/")

    def test_example5(self):
        self.assertEqual(SimplifyPath("/.../a/../b/c/../d/./"), "/.../b/d")


if __name__ == "__main__":
    unittest.main()
v0 (commit) © 2025 @p13i.io | Load balancer proxied to: cs-code-viewer-1:8080 in 2ms.