def test_e2_create_turtles_negativ(self): """ Test create_turtles() function for creating all Turtles and placing them. With negativ values """ with self.assertRaises(IndexError): gui.create_turtles(-3, -3)
def test_e1_create_turtles(self): """ Test create_turtles() function for creating all Turtles and placing them. """ gui.create_turtles(3, 3) self.assertEqual(gui.TURTLES[0][0].pos(), (0, 0)) self.assertEqual(gui.TURTLES[2][2].pos(), (50, 50)) self.assertIs(gui.TURTLES[0][0], gui.SCREEN.turtles()[0])
def test_f1_hide_all_turtles(self): """ Test hide_all_turtles() function. """ gui.create_turtles(3, 3) gui.hide_all_turtles() for rows in gui.TURTLES: for t in rows: self.assertFalse(t.isvisible())
def test_g1_update_turtle(self): """ Test update_turtle() function. """ gui.create_turtles(3, 3) gui.update_turtle(0, 0, 1) self.assertEqual(gui.TURTLES[0][0].color(), (gui.T_CONF["show_color"], gui.T_CONF["show_color"])) gui.update_turtle(1, 1, 0) self.assertEqual(gui.TURTLES[1][1].color(), (gui.T_CONF["hide_color"], gui.T_CONF["hide_color"]))
def test_h1_update_board(self): """ Test update_board() function. """ gui.create_turtles(3, 3) gui.update_turtle(0, 0, 0) gamefield = [ [0, 0, 1], [1, 0, 0], [0, 1, 0], ] gui.update_board(gamefield) self.assertEqual(gui.TURTLES[0][2].color(), (gui.T_CONF["show_color"], gui.T_CONF["show_color"])) self.assertEqual(gui.TURTLES[1][0].color(), (gui.T_CONF["show_color"], gui.T_CONF["show_color"])) self.assertEqual(gui.TURTLES[2][1].color(), (gui.T_CONF["show_color"], gui.T_CONF["show_color"])) self.assertEqual(gui.TURTLES[0][0].color(), (gui.T_CONF["hide_color"], gui.T_CONF["hide_color"]))