def test_dijkstra_several_items_random_order(self): lst = ['white', 'blue', 'blue', 'red', 'white', 'red', 'white'] expected_end = [ 'red', 'red', 'white', 'white', 'white', 'blue', 'blue' ] dijkstra(lst) self.assertEqual(expected_end, lst)
def test_dijkstra_red_white_blue(self): colours_list = ['blue', 'white', 'blue', 'red', 'white'] dijkstra(colours_list) actual = colours_list expected = ['red', 'white', 'white', 'blue', 'blue'] self.assertEqual(expected, actual)
def test_dijkstra_not_a_list(self, mock_stdout): colours_list = [1] dijkstra(colours_list) actual = mock_stdout.getvalue() expected = "" self.assertEqual(expected, actual)
def test_dijkstra_empty_list(self, mock_stdout): colours_list = [] dijkstra(colours_list) actual = mock_stdout.getvalue() expected = "Error: This is not a valid value!\n" self.assertEqual(expected, actual)
def test_dijkstra_no_reds(self): lst = ['white', 'blue', 'white', 'blue'] expected_end = ['white', 'white', 'blue', 'blue'] dijkstra(lst) self.assertEqual(expected_end, lst)
def test_dijkstra_first_item_is_white(self): lst = ['white', 'red', 'blue', 'red', 'white'] expected_end = ['red', 'red', 'white', 'white', 'blue'] dijkstra(lst) self.assertEqual(expected_end, lst)
def test_dijkstra_items_already_in_order(self): lst = ['red', 'white', 'blue'] expected_end = ['red', 'white', 'blue'] dijkstra(lst) self.assertEqual(expected_end, lst)