def test_joinPath_normalize(self): from zope.app.traversing.api import joinPath path = u'/bla' args = ('foo', 'bar', '..', 'baz', 'bone') self.assertEqual(joinPath(path, *args), u'/bla/foo/baz/bone') path = u'bla' args = ('foo', 'bar', '.', 'baz', 'bone') self.assertEqual(joinPath(path, *args), u'bla/foo/bar/baz/bone') path = u'/' args = ('foo', 'bar', '.', 'baz', 'bone') self.assertEqual(joinPath(path, *args), u'/foo/bar/baz/bone')
def test_joinPath(self): from zope.app.traversing.api import joinPath path = u'/bla' args = ('foo', 'bar', 'baz', 'bone') self.assertEqual(joinPath(path, *args), u'/bla/foo/bar/baz/bone') path = u'bla' args = ('foo', 'bar', 'baz', 'bone') self.assertEqual(joinPath(path, *args), u'bla/foo/bar/baz/bone') path = u'bla' args = ('foo', 'bar/baz', 'bone') self.assertEqual(joinPath(path, *args), u'bla/foo/bar/baz/bone') path = u'bla/' args = ('foo', 'bar', 'baz', 'bone') self.assertRaises(ValueError, joinPath, path, *args)