def test_should_return_boolean(): result = Dice().__gt__(Dice()) assert isinstance(result, bool) is True
def test_should_return_false_when_other_dice_is_greater(): result = Dice(sides=2).__gt__(Dice(sides=20)) assert result is False
def test_should_return_true_when_other_dice_is_lower(): result = Dice(sides=20).__gt__(Dice(sides=2)) assert result is True
def test_should_return_last_roll(): dice = Dice() dice.last_roll = 8 assert dice.__len__() == 8
def test_should_raise_type_error_when_not_dice_object(): with pytest.raises(TypeError) as err: Dice().__gt__(object) assert str(err.value) == 'Operation only allowed between Dice\'s instances'
def test_should_return_true_when_same_number_of_sides(): dice = Dice(sides=10) assert Dice(sides=10).__eq__(dice) is True
def test_should_return_false_when_not_a_dice_instance(): assert Dice().__eq__(object) is False
def test_should_raise_type_error_when_not_int(): with pytest.raises(TypeError) as err: Dice().__mul__(object) assert str(err.value) == 'Unsupported operand type(s) for *'
def test_should_call_roll_multiple_times(mock_roll): result = Dice(sides=10).__mul__(3) assert mock_roll.call_count == 3 assert result == [mock_roll.return_value] * 3
def test_should_return_true_when_other_dice_is_equal(): result = Dice(20).__ge__(Dice(20)) assert result is True