def test_flatten_path(self): self.assertEqual('/', flatten_path('')) self.assertEqual('//', flatten_path('//')) self.assertEqual('///', flatten_path('///')) self.assertEqual('/http://', flatten_path('/http://')) self.assertEqual('/', flatten_path('//', flatten_slashes=True)) self.assertEqual('/', flatten_path('///', flatten_slashes=True)) self.assertEqual('/http:/', flatten_path('/http://', flatten_slashes=True)) self.assertEqual('/a', flatten_path('a')) self.assertEqual('/a/', flatten_path('a/')) self.assertEqual('/', flatten_path('.')) self.assertEqual('/', flatten_path('./')) self.assertEqual('/', flatten_path('/.')) self.assertEqual('/', flatten_path('/..')) self.assertEqual('/', flatten_path('../')) self.assertEqual('/', flatten_path('./.')) self.assertEqual('/', flatten_path('/')) self.assertEqual('/', flatten_path('/../../../')) self.assertEqual('/', flatten_path('/.././')) self.assertEqual('/a', flatten_path('/../a/../a')) self.assertEqual('/a/', flatten_path('/../a/../a/')) self.assertEqual('//a/a/', flatten_path('//a//../a/')) self.assertEqual('/a//a///a', flatten_path('/a//a///a')) self.assertEqual('/a/', flatten_path('//a//../a/', flatten_slashes=True)) self.assertEqual('/a/a/a', flatten_path('/a//a///a', flatten_slashes=True)) self.assertEqual('/index.html', flatten_path('/./index.html')) self.assertEqual('/index.html', flatten_path('/../index.html')) self.assertEqual('/a/index.html', flatten_path('/a/./index.html')) self.assertEqual('/index.html', flatten_path('/a/../index.html')) self.assertEqual('/doc/index.html', flatten_path('/../doc/index.html')) self.assertEqual('/dog/doc/index.html', flatten_path('/dog/cat/../doc/index.html')) self.assertEqual( '/dog/doc/index.html', flatten_path('/dog/../dog/./cat/../doc/././../doc/index.html')) self.assertEqual( '/dog//doc//doc/index.html/', flatten_path('/dog/../dog//./cat/../doc/.///./../doc/index.html/')) self.assertEqual( '/dog/doc/index.html/', flatten_path('/dog/../dog//./cat/../doc/.///./../doc/index.html/', flatten_slashes=True))
def test_flatten_path(self): self.assertEqual('/', flatten_path('/')) self.assertEqual('/', flatten_path('/../../../')) self.assertEqual('/', flatten_path('/.././')) self.assertEqual('/a', flatten_path('/../a/../a')) self.assertEqual('/a/', flatten_path('/../a/../a/')) self.assertEqual('//a/a/', flatten_path('//a//../a/')) self.assertEqual('/index.html', flatten_path('/./index.html')) self.assertEqual('/index.html', flatten_path('/../index.html')) self.assertEqual('/a/index.html', flatten_path('/a/./index.html')) self.assertEqual('/index.html', flatten_path('/a/../index.html')) self.assertEqual('/doc/index.html', flatten_path('/../doc/index.html')) self.assertEqual( '/dog/doc/index.html', flatten_path('/dog/cat/../doc/index.html') ) self.assertEqual( '/dog/doc/index.html', flatten_path('/dog/../dog/./cat/../doc/././../doc/index.html') )
def test_flatten_path(self): self.assertEqual('/', flatten_path('')) self.assertEqual('//', flatten_path('//')) self.assertEqual('///', flatten_path('///')) self.assertEqual('/http://', flatten_path('/http://')) self.assertEqual('/', flatten_path('//', flatten_slashes=True)) self.assertEqual('/', flatten_path('///', flatten_slashes=True)) self.assertEqual('/http:/', flatten_path('/http://', flatten_slashes=True)) self.assertEqual('/a', flatten_path('a')) self.assertEqual('/a/', flatten_path('a/')) self.assertEqual('/', flatten_path('.')) self.assertEqual('/', flatten_path('./')) self.assertEqual('/', flatten_path('/.')) self.assertEqual('/', flatten_path('/..')) self.assertEqual('/', flatten_path('../')) self.assertEqual('/', flatten_path('./.')) self.assertEqual('/', flatten_path('/')) self.assertEqual('/', flatten_path('/../../../')) self.assertEqual('/', flatten_path('/.././')) self.assertEqual('/a', flatten_path('/../a/../a')) self.assertEqual('/a/', flatten_path('/../a/../a/')) self.assertEqual('//a/a/', flatten_path('//a//../a/')) self.assertEqual('/a//a///a', flatten_path('/a//a///a')) self.assertEqual('/a/', flatten_path('//a//../a/', flatten_slashes=True)) self.assertEqual('/a/a/a', flatten_path('/a//a///a', flatten_slashes=True)) self.assertEqual('/index.html', flatten_path('/./index.html')) self.assertEqual('/index.html', flatten_path('/../index.html')) self.assertEqual('/a/index.html', flatten_path('/a/./index.html')) self.assertEqual('/index.html', flatten_path('/a/../index.html')) self.assertEqual('/doc/index.html', flatten_path('/../doc/index.html')) self.assertEqual( '/dog/doc/index.html', flatten_path('/dog/cat/../doc/index.html') ) self.assertEqual( '/dog/doc/index.html', flatten_path('/dog/../dog/./cat/../doc/././../doc/index.html') ) self.assertEqual( '/dog//doc//doc/index.html/', flatten_path('/dog/../dog//./cat/../doc/.///./../doc/index.html/') ) self.assertEqual( '/dog/doc/index.html/', flatten_path('/dog/../dog//./cat/../doc/.///./../doc/index.html/', flatten_slashes=True) )
def test_flatten_path(self): self.assertEqual('/', flatten_path('/')) self.assertEqual('/', flatten_path('/../../../')) self.assertEqual('/', flatten_path('/.././')) self.assertEqual('/a', flatten_path('/../a/../a')) self.assertEqual('/a/', flatten_path('/../a/../a/')) self.assertEqual('//a/a/', flatten_path('//a//../a/')) self.assertEqual('/index.html', flatten_path('/./index.html')) self.assertEqual('/index.html', flatten_path('/../index.html')) self.assertEqual('/a/index.html', flatten_path('/a/./index.html')) self.assertEqual('/index.html', flatten_path('/a/../index.html')) self.assertEqual('/doc/index.html', flatten_path('/../doc/index.html')) self.assertEqual('/dog/doc/index.html', flatten_path('/dog/cat/../doc/index.html')) self.assertEqual( '/dog/doc/index.html', flatten_path('/dog/../dog/./cat/../doc/././../doc/index.html'))