Пример #1
0
 def test_execute_print_operation(self):
     a = StringIO.StringIO()
     sys.stdout = a
     challenge.execute_operation([5], ['print'])
     sys.stdout = sys.__stdout__
     e = '[5]\n'
     self.assertEqual(a.getvalue(), e)
Пример #2
0
 def test_execute_reverse(self):
     e = [8, 2, 1]
     a = challenge.execute_operation([1, 2, 8], ['reverse'])
     self.assertEqual(a, e)
Пример #3
0
 def test_execute_pop(self):
     e = [2]
     a = challenge.execute_operation([2, 8], ['pop'])
     self.assertEqual(a, e)
Пример #4
0
 def test_execute_sort(self):
     e = [2, 8]
     a = challenge.execute_operation([8, 2], ['sort'])
     self.assertEqual(a, e)
Пример #5
0
 def test_execute_append(self):
     e = [8, 2]
     a = challenge.execute_operation([8], ['append', '2'])
     self.assertEqual(a, e)
Пример #6
0
 def test_execute_remove(self):
     e = [8]
     a = challenge.execute_operation([5, 8], ['remove', '5'])
     self.assertEqual(a, e)
Пример #7
0
 def test_execute_insert_operation_on_empty_list(self):
     a = challenge.execute_operation([], ['insert', '0', '5'])
     e = [5]
     self.assertEqual(a, e)