def test_get_filled_with(self): tkinter = Tk() canvas = Canvas(tkinter, width=500, height=500) cell0 = Cell(canvas, 200, 300, 50, "grey") self.assertEqual(None, cell0.get_filled_with()) piece0 = Piece(cell0, "white") self.assertEqual(piece0, cell0.get_filled_with())
def test_fill(self): tkinter = Tk() canvas = Canvas(tkinter, width=500, height=500) cell0 = Cell(canvas, 200, 300, 50, "grey") cell1 = Cell(canvas, 200, 300, 50, "white") piece0 = Piece(cell0, "white") piece1 = Piece(cell1, "black") try: piece1 = Piece(cell0, "black") print(str(piece1) + " did not throw an exception!") self.assertNotEqual(piece1, cell0.get_filled_with()) except ValueError: self.assertEqual(piece0, cell0.get_filled_with()) self.assertEqual(cell1, piece1.get_cell()) self.assertEqual(cell0, cell0.get_filled_with().get_cell())