def test_intg_rqr_is_not_equal_using_ne_should_throw_on_equal_objects():
    """
    Tests the `is_not_equal_to_using_ne()` requires validator method through `Condition.requires_obj()` to see if it,
    throws an ArgumentError when the object is equal to the supplied object using the
    `__ne__()` validator method.
    """
    # Arrange
    actual = TypeEqualityExample(10)
    expected = TypeEqualityExample(10)

    # Assert
    with pytest.raises(ArgumentError):
        # Act
        Condition.requires_obj(actual, 'actual').is_not_equal_to_using_ne(expected)
Пример #2
0
def test_is_not_equal_using_ne_should_throw_on_equal_objects():
    """
    Tests that the `is_not_equal_to_using_ne()` method throws an ArgumentError
    when the object is equal to the supplied object using the `__ne__()` method.
    """
    # Arrange
    actual = TypeEqualityExample(10)
    expected = TypeEqualityExample(10)
    validator = ObjectValidator(actual, 'actual')

    # Assert
    with pytest.raises(ArgumentError):
        # Act
        validator.is_not_equal_to_using_ne(expected)
Пример #3
0
def test_is_not_equal_using_ne_returns_validator_self():
    """
    Tests if the `is_not_equal_to_using_ne()` validator method returns itself after the validation is performed,
    so that additional validations can be performed.
    """
    # Arrange
    actual = TypeEqualityExample(10)
    expected = TypeEqualityExample(11)
    validator = ObjectValidator(actual, 'actual')

    # Act
    validator_returned = validator.is_not_equal_to_using_ne(expected)

    # Assert
    assert validator_returned is validator
def test_intg_rqr_is_not_equal_using_ne_accepts_unequal_objects():
    """
    Tests the `is_not_equal_to_using_eq()` requires validator method through `Condition.requires_obj()` to see if it,
    throws an ArgumentError when the object is not equal to the supplied object using the
    `__ne__()` validator method.
    """
    # Arrange
    actual = TypeEqualityExample(10)
    expected = TypeEqualityExample(11)

    # Act
    try:
        Condition.requires_obj(actual, 'actual').is_not_equal_to_using_ne(expected)
    # Assert
    except ArgumentError:
        pytest.fail(f'`{actual.__class__.__name__}` should be equal to `{expected.__class__.__name__}` when using the `__eq__()` function, but an error occurred')
Пример #5
0
def test_is_not_equal_using_ne_accepts_unequal_objects():
    """
    Tests that the `is_not_equal_to_using_eq()` method throws an ArgumentError
    when the object is not equal to the supplied object using the `__ne__()` method.
    """
    # Arrange
    actual = TypeEqualityExample(10)
    expected = TypeEqualityExample(11)
    validator = ObjectValidator(actual, 'actual')

    # Act
    try:
        validator.is_not_equal_to_using_ne(expected)
    # Assert
    except ArgumentError:
        pytest.fail(f'`{actual.__class__.__name__}` should be equal to `{expected.__class__.__name__}` when using the `__eq__()` function, but an error occurred')