Ejemplo n.º 1
0
 def test_unique_words(self):
     self.assertEqual(
         "/home/radorado/code/hackbulgaria",
         solution.reduce_file_path(
             "/home//radorado/code/./hackbulgaria/week0/../"))
     self.assertEqual('/', solution.reduce_file_path("/"))
     self.assertEqual('/', solution.reduce_file_path("/srv/../"))
     self.assertEqual("/srv/www/htdocs/wtf",
                      solution.reduce_file_path("/srv/www/htdocs/wtf/"))
     self.assertEqual('/', solution.reduce_file_path("//////////////"))
Ejemplo n.º 2
0
 def test_reduce_file_path(self):
     self.assertEqual("/", reduce_file_path("/"))
     self.assertEqual("/", reduce_file_path("/srv/../"))
     self.assertEqual("/srv/www/htdocs/wtf", reduce_file_path("/srv/www/htdocs/wtf/"))
     self.assertEqual("/srv/www/htdocs/wtf", reduce_file_path("/srv/www/htdocs/wtf"))
     self.assertEqual("/srv", reduce_file_path("/srv/./././././"))
     self.assertEqual("/etc/wtf", reduce_file_path("/etc//wtf/"))
     self.assertEqual("/", reduce_file_path("/etc/../etc/../etc/../"))
     self.assertEqual("/", reduce_file_path("//////////////"))
     self.assertEqual("/", reduce_file_path("/../"))
     self.assertEqual("/", reduce_file_path("/../.."))
Ejemplo n.º 3
0
 def test_problem_statement_cases(self):
     self.assertEqual("/", reduce_file_path("/"))
     self.assertEqual("/", reduce_file_path("/srv/../"))
     self.assertEqual("/srv/www/htdocs/wtf", reduce_file_path("/srv/www/htdocs/wtf/"))
     self.assertEqual("/srv/www/htdocs/wtf", reduce_file_path("/srv/www/htdocs/wtf"))
     self.assertEqual("/srv", reduce_file_path("/srv/./././././"))
     self.assertEqual("/etc/wtf", reduce_file_path("/etc//wtf/"))
     self.assertEqual("/", reduce_file_path("/etc/../etc/../etc/../"))
     self.assertEqual("/", reduce_file_path("//////////////"))
     self.assertEqual("/", reduce_file_path("/../"))
Ejemplo n.º 4
0
 def test_reduce_file_path(self):
     self.assertEqual("/", solution.reduce_file_path("/"))
     self.assertEqual("/", solution.reduce_file_path("/srv/../"))
     self.assertEqual("/srv/www/htdocs/wtf",
                      solution.reduce_file_path("/srv/www/htdocs/wtf/"))
     self.assertEqual("/srv/www/htdocs/wtf",
                      solution.reduce_file_path("/srv/www/htdocs/wtf"))
     self.assertEqual("/srv", solution.reduce_file_path("/srv/./././././"))
     self.assertEqual("/etc/wtf", solution.reduce_file_path("/etc//wtf/"))
     self.assertEqual("/",
                      solution.reduce_file_path("/etc/../etc/../etc/../"))
     self.assertEqual("/", solution.reduce_file_path("//////////////"))
     self.assertEqual("/", solution.reduce_file_path("/../"))
     self.assertEqual("/", solution.reduce_file_path("/../.."))
 def test_reduce_file_path(self):
     self.assertEqual(reduce_file_path("/"), "/")
     self.assertEqual(reduce_file_path("/srv/../"), "/")
     self.assertEqual(reduce_file_path("/srv/www/htdocs/wtf/"),
                      "/srv/www/htdocs/wtf")
     self.assertEqual(reduce_file_path("/srv/www/htdocs/wtf"),
                      "/srv/www/htdocs/wtf")
     self.assertEqual(reduce_file_path("/srv/./././././"), "/srv")
     self.assertEqual(reduce_file_path("/etc//wtf/"), "/etc/wtf")
     self.assertEqual(reduce_file_path("/etc/../etc/../etc/../"), "/")
     self.assertEqual(reduce_file_path("//////////////"), "/")
     self.assertEqual(reduce_file_path("/../"), "/")
Ejemplo n.º 6
0
	def test_with_two_dots(self):
		self.assertEqual("/",reduce_file_path("/srv/../"))
		self.assertEqual("/",reduce_file_path("/etc/../etc/../etc/../"))
		self.assertEqual("/",reduce_file_path("/../"))
		self.assertEqual("/",reduce_file_path("/etc/.."))
		self.assertEqual("/",reduce_file_path("/etc/../"))
		self.assertEqual("/etc/code",reduce_file_path("/etc/home/../code"))
		self.assertEqual("/",reduce_file_path("/.."))
		self.assertEqual("/home",reduce_file_path("/home//../////home"))
		self.assertEqual("/home/home",reduce_file_path("/../////home/home/././../home/"))
		self.assertEqual("/",reduce_file_path("/home/././../"))
		self.assertEqual("/lacho",reduce_file_path("/home/././../lacho"))
		self.assertEqual("/",reduce_file_path("/home/../././"))
Ejemplo n.º 7
0
 def test_with_root(self):
     self.assertEqual(solution.reduce_file_path('/'), '/')
Ejemplo n.º 8
0
 def test_handles_multiple_slashes(self):
     self.assertEqual(solution.reduce_file_path('////////'), '/')
 def test_correctness(self):
     self.assertEqual(reduce_file_path('/etc/..//.././'), '/')
     self.assertEqual(reduce_file_path('/srv/www/'), '/srv/www')
     self.assertEqual(reduce_file_path('/niki/lqlq'), '/niki/lqlq')
Ejemplo n.º 10
0
 def test_reduce_file_path_2(self):
     self.assertEqual("/", solution.reduce_file_path("/srv/../"))
Ejemplo n.º 11
0
 def test_reduce_file_path_8(self):
     self.assertEqual("/", solution.reduce_file_path("//////////////"))
Ejemplo n.º 12
0
	def test_reduce_file_path_0(self):
		self.assertEqual("/", reduce_file_path("/"))
Ejemplo n.º 13
0
 def test_10(self):
     new_path = "/home//radorado/code/./hackbulgaria/week0/../"
     self.assertEqual("/home/radorado/code/hackbulgaria", solution.reduce_file_path(new_path))
Ejemplo n.º 14
0
 def test_6(self):
     new_path = "/etc//wtf/"
     self.assertEqual("/etc/wtf", solution.reduce_file_path(new_path))
Ejemplo n.º 15
0
 def test_one(self):
     self.assertEqual("/", reduce_file_path("/"))
Ejemplo n.º 16
0
 def test_2(self):
     new_path = "/srv/../"
     self.assertEqual("/", solution.reduce_file_path(new_path))
Ejemplo n.º 17
0
 def test_eight(self):
     self.assertEqual("/", reduce_file_path("//////////////"))
Ejemplo n.º 18
0
 def test_four(self):
     self.assertEqual("/srv/www/htdocs/wtf",
                      reduce_file_path("/srv/www/htdocs/wtf"))
Ejemplo n.º 19
0
 def test_three(self):
     self.assertEqual("/srv/www/htdocs/wtf",
                      reduce_file_path("/srv/www/htdocs/wtf/"))
Ejemplo n.º 20
0
	def test_with__more_slashes(self):
		self.assertEqual("/",reduce_file_path("//////////////"))
		self.assertEqual("/etc/wtf",reduce_file_path("/etc//wtf/"))
Ejemplo n.º 21
0
 def test_nine(self):
     self.assertEqual("/", solution.reduce_file_path("/../"))
Ejemplo n.º 22
0
 def test_reduce_file_path_6(self):
     self.assertEqual("/etc/wtf", solution.reduce_file_path("/etc//wtf/"))
Ejemplo n.º 23
0
 def test_reduce_file_path4(self):
     self.assertEqual("/", solution.reduce_file_path("/etc/../etc/../etc/../"))
Ejemplo n.º 24
0
 def test_4(self):
     new_path = "/srv/www/htdocs/wtf"
     self.assertEqual("/srv/www/htdocs/wtf", solution.reduce_file_path(new_path))
Ejemplo n.º 25
0
 def test_reduce_file_path1(self):
     self.assertEqual("/srv/www/htdocs/wtf", solution.reduce_file_path('/srv/www/htdocs/wtf/'))
Ejemplo n.º 26
0
	def test_reduce_file_path_1(self):
		self.assertEqual("/etc/wtf", reduce_file_path("/etc//wtf/"))
Ejemplo n.º 27
0
 def test_handles_double_dots(self):
     self.assertEqual(solution.reduce_file_path('/fmi/karh/../'), '/fmi')
Ejemplo n.º 28
0
 def test_five(self):
     self.assertEqual("/srv", solution.reduce_file_path("/srv/./././././"))
Ejemplo n.º 29
0
 def test_reduce_file_path_8(self):
     self.assertEqual("/", solution.reduce_file_path("//////////////"))
Ejemplo n.º 30
0
 def test_reduce_file_path3(self):
     self.assertEqual("/etc/wtf", solution.reduce_file_path('/etc//wtf/'))
Ejemplo n.º 31
0
 def test_foure(self):
     self.assertEquals(reduce_file_path("/srv/www/htdocs/wtf"),
                       "/srv/www/htdocs/wtf")
Ejemplo n.º 32
0
 def test_reduce_file_path5(self):
     self.assertEqual("/home/didi", solution.reduce_file_path("/home/didi/lesson/../"))
Ejemplo n.º 33
0
 def test_five(self):
     self.assertEquals(reduce_file_path("/srv/./././././"), "/srv")
Ejemplo n.º 34
0
 def test_reduce_file_path2(self):
     self.assertEqual("/srv", solution.reduce_file_path('/srv/./././././'))
Ejemplo n.º 35
0
 def test_six(self):
     self.assertEquals(reduce_file_path("/etc//wtf/"), "/etc/wtf")
Ejemplo n.º 36
0
 def test_handles_trailing_slashes(self):
     self.assertEqual(solution.reduce_file_path('/fmi/karh/shit/'),
                      '/fmi/karh/shit')
Ejemplo n.º 37
0
 def test_seven(self):
     self.assertEquals(reduce_file_path("/etc/../etc/../etc/../"), "/")
Ejemplo n.º 38
0
 def test_handles_single_dots(self):
     self.assertEqual(solution.reduce_file_path('/fmi/././././'), '/fmi')
Ejemplo n.º 39
0
 def test_eigth(self):
     self.assertEquals(reduce_file_path("//////////////"), "/")
Ejemplo n.º 40
0
	def test_with_one_dot(self):
		self.assertEqual("/srv",reduce_file_path("/srv/./././././"))
		self.assertEqual("/home",reduce_file_path("/home/./"))
Ejemplo n.º 41
0
 def test_one(self):
     self.assertEquals(reduce_file_path("/"), "/")
Ejemplo n.º 42
0
	def test_simple_path(self):
		self.assertEqual("/", reduce_file_path("/"))
		self.assertEqual("/srv/www/htdocs/wtf",reduce_file_path("/srv/www/htdocs/wtf/"))
		self.assertEqual("/srv/www/htdocs/wtf", reduce_file_path("/srv/www/htdocs/wtf"))
Ejemplo n.º 43
0
 def test_two(self):
     self.assertEquals(reduce_file_path("/srv/../"), "/")
Ejemplo n.º 44
0
 def test_reduce_file_path_4(self):
     self.assertEqual("/srv/www/htdocs/wtf", solution.reduce_file_path("/srv/www/htdocs/wtf"))
 def test_unique_words(self):
     self.assertEqual("/home/radorado/code/hackbulgaria", solution.reduce_file_path("/home//radorado/code/./hackbulgaria/week0/../"))
     self.assertEqual('/', solution.reduce_file_path("/"))
     self.assertEqual('/', solution.reduce_file_path("/srv/../"))
     self.assertEqual("/srv/www/htdocs/wtf", solution.reduce_file_path("/srv/www/htdocs/wtf/"))
     self.assertEqual('/', solution.reduce_file_path("//////////////"))
Ejemplo n.º 46
0
 def test_reduce_file_path_7(self):
     self.assertEqual("/", solution.reduce_file_path("/etc/../etc/../etc/../"))
Ejemplo n.º 47
0
 def test_reduce_file_path(self):
     self.assertEqual('/', solution.reduce_file_path('.././'))
     self.assertEqual('/home/asd',\
             solution.reduce_file_path('/home/sad/.././asd/'))
     self.assertEqual('/', solution.reduce_file_path('////'))
Ejemplo n.º 48
0
 def test_reduce_file_path_2(self):
     self.assertEqual("/", solution.reduce_file_path("/srv/../"))
Ejemplo n.º 49
0
	def test_reduce_file_path_2(self):
		self.assertEqual("/", reduce_file_path("/etc/../etc/../etc/../"))