def test_is_null_throws_error_on_not_null_value(): """ Tests that the `is_null()` method throws an ArgumentNullError when it is supplied with a type that is not None (Null). """ # Arrange type = TypeExample() validator = ObjectValidator(type, 'type') # Assert with pytest.raises(ArgumentNullError): # Act validator.is_null()
def test_is_null_accepts_null_value(): """ Tests that the `is_null()` method does not throw an ArgumentNullError when it is supplied with a type that is None (Null). """ # Arrange type = None validator = ObjectValidator(type, 'type') # Act try: validator.is_null() # Assert except ArgumentNullError: pytest.fail(f'The object should have been None (Null), but an error occurred.')
def test_is_null_returns_validator_self(): """ Tests if the `is_true()` validator method returns itself after the validation is performed, so that additional validations can be performed. """ # Arrange type = None validator = ObjectValidator(type, 'type') # Act validator_returned = validator.is_null() # Assert assert validator_returned is validator