def test_remove_dot_segments(self): self.assertEqual(remove_dot_segments("../foo"), "foo") self.assertEqual(remove_dot_segments("../../foo"), "foo") self.assertEqual(remove_dot_segments("./foo"), "foo") self.assertEqual(remove_dot_segments("/./"), "/") self.assertEqual(remove_dot_segments("/../"), "/") self.assertEqual(remove_dot_segments("/foo/bar/baz/../qux"), "/foo/bar/qux") self.assertEqual(remove_dot_segments("/foo/.."), "/") self.assertEqual(remove_dot_segments("foo/bar/baz"), "foo/bar/baz") self.assertEqual(remove_dot_segments(".."), "") self.assertEqual(remove_dot_segments("."), "") self.assertEqual(remove_dot_segments("/."), "/") # I don't think this is RFC compliant... self.assertEqual(remove_dot_segments("//foo//"), "/foo/")
def test_remove_dot_segments(self): self.assertEqual(remove_dot_segments('../foo'), 'foo') self.assertEqual(remove_dot_segments('../../foo'), 'foo') self.assertEqual(remove_dot_segments('./foo'), 'foo') self.assertEqual(remove_dot_segments('/./'), '/') self.assertEqual(remove_dot_segments('/../'), '/') self.assertEqual(remove_dot_segments('/foo/bar/baz/../qux'), '/foo/bar/qux') self.assertEqual(remove_dot_segments('/foo/..'), '/') self.assertEqual(remove_dot_segments('foo/bar/baz'), 'foo/bar/baz') self.assertEqual(remove_dot_segments('..'), '') self.assertEqual(remove_dot_segments('.'), '') self.assertEqual(remove_dot_segments('/.'), '/') self.assertEqual(remove_dot_segments('/.foo'), '/.foo') self.assertEqual(remove_dot_segments('/..foo'), '/..foo') self.assertEqual(remove_dot_segments(''), '') self.assertEqual(remove_dot_segments('/a/b/c/./../../g'), '/a/g') self.assertEqual(remove_dot_segments('mid/content=5/../6'), 'mid/6') # I don't think this is RFC compliant... self.assertEqual(remove_dot_segments('//foo//'), '/foo/')