def test_cell_toggle_flag(self): my_cell = Cell() # should not change. my_cell.state = State.OPEN my_cell.toggle_flag() self.assertEqual(my_cell.state, State.OPEN) # should change to default. my_cell.state = State.FLAGGED my_cell.toggle_flag() self.assertEqual(my_cell.state, State.DEFAULT) # should change to flagged. my_cell.state = State.DEFAULT my_cell.toggle_flag() self.assertEqual(my_cell.state, State.FLAGGED)
def test_cell_clear(self): my_cell = Cell() my_cell.is_bomb = True my_cell.state = State.FLAGGED # Before clear should not be equivalen to a new cell. self.assertNotEqual(my_cell, Cell()) my_cell.clear() # After clear should be equivalent to a new cell. self.assertEqual(my_cell, Cell())