Exemplo n.º 1
0
def test_intg_rqr_is_false_throws_argument_error_on_true():
    """
    Tests the `is_false()` requires validator method through `Condition.requires_bool()` to see if it,
	throws an `ArgumentError` when the supplied value is True.
    """
    # Arrange
    value = True

    # Assert
    with pytest.raises(ArgumentError):
        # Act
        Condition.requires_bool(value, 'value').is_false()
Exemplo n.º 2
0
def test_intg_rqr_is_false_accepts_false():
    """
    Tests the `is_false()` requires validator method through `Condition.requires_bool()` to see if it,
	does not throw an `ArgumentError` when the supplied value is False.
    """
    # Arrange
    value = False

    # Act
    try:
        Condition.requires_bool(value, 'value').is_false()
    # Asset
    except ArgumentError:
        pytest.fail()
Exemplo n.º 3
0
def test_requires_returns_boolean_validator(value: bool):
    """
    Tests if the `Condition.requires()` method returns the validator that is appropriate to
    the boolean datatype.
    """
    # Act
    validator = Condition.requires_bool(value, 'value')

    # Assert
    assert isinstance(validator, BooleanValidator)
Exemplo n.º 4
0
def test_intg_rqr_prnt_get_value_returns_value(value):
    """
    Tests if the parent `get_value()` requires validator method returns the value saved in the validator.
    """
	# Act
    actual = Condition.requires_bool(value, 'value').get_value()

    # Assert
    assert actual == value
    assert actual is value
    assert type(actual) == type(value)