From 77f351b8cd15d2e76651f3c7716212f6502bcdfc Mon Sep 17 00:00:00 2001 From: Emerson Delatorre Date: Tue, 13 Feb 2024 11:29:14 -0300 Subject: [PATCH] Refactor validation contract tests --- .../test_string_validation_contract.py | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/validations/test_string_validation_contract.py b/tests/validations/test_string_validation_contract.py index cd37d73..d0090eb 100644 --- a/tests/validations/test_string_validation_contract.py +++ b/tests/validations/test_string_validation_contract.py @@ -6,7 +6,7 @@ def test_should_be_valid_when_is_lower_than_20(entityMock: SampleEntity): contract = Contract().is_lower_than( entityMock.first_name, 20, "first_name", "any message" ) - assert contract.is_valid() + assert contract.is_valid assert len(contract.get_notifications()) == 0 @@ -16,7 +16,7 @@ def test_should_be_invalid_and_return_once_notification_when_not_is_lower_than_5 contract = Contract().is_lower_than( entityMock.first_name, 5, "first_name", "any message" ) - assert contract.is_valid() is False + assert contract.is_valid is False assert len(contract.get_notifications()) == 1 @@ -26,7 +26,7 @@ def test_should_be_valid_when_is_lower_or_equals_than_20( contract = Contract().is_lower_or_equals_than( entityMock.first_name, 20, "first_name", "any message" ) - assert contract.is_valid() + assert contract.is_valid assert len(contract.get_notifications()) == 0 @@ -36,7 +36,7 @@ def test_should_be_invalid_and_return_once_notification_when_not_is_lower_or_equ contract = Contract().is_lower_or_equals_than( entityMock.first_name, 14, "first_name", "any message" ) - assert contract.is_valid() is False + assert contract.is_valid is False assert len(contract.get_notifications()) == 1 @@ -44,7 +44,7 @@ def test_should_be_valid_when_is_greater_than_10(entityMock: SampleEntity): contract = Contract().is_greater_than( entityMock.first_name, 10, "first_name", "any message" ) - assert contract.is_valid() + assert contract.is_valid assert len(contract.get_notifications()) == 0 @@ -54,7 +54,7 @@ def test_should_be_invalid_and_return_once_notification_when_not_is_greater_than contract = Contract().is_greater_than( entityMock.first_name, 15, "first_name", "any message" ) - assert contract.is_valid() is False + assert contract.is_valid is False assert len(contract.get_notifications()) == 1 @@ -64,7 +64,7 @@ def test_should_be_valid_when_is_greater_or_equals_than_13( contract = Contract().is_greater_or_equals_than( entityMock.first_name, 13, "first_name", "any message" ) - assert contract.is_valid() + assert contract.is_valid assert len(contract.get_notifications()) == 0 @@ -74,13 +74,13 @@ def test_should_be_invalid_and_return_once_notification_when_not_is_greater_or_e contract = Contract().is_greater_or_equals_than( entityMock.first_name, 14, "first_name", "any message" ) - assert contract.is_valid() is False + assert contract.is_valid is False assert len(contract.get_notifications()) == 1 def test_should_be_valid_when_is_none(): - contract = Contract().is_none(None, "first_name", "any message") - assert contract.is_valid() + contract = Contract().is_none(None, "first_name", "any message") # type: ignore + assert contract.is_valid assert len(contract.get_notifications()) == 0 @@ -88,7 +88,7 @@ def test_should_be_invalid_and_return_once_notification_when_not_is_none( entityMock: SampleEntity, ): contract = Contract().is_none(entityMock.first_name, "first_name", "any message") - assert contract.is_valid() is False + assert contract.is_valid is False assert len(contract.get_notifications()) == 1 @@ -96,13 +96,13 @@ def test_should_be_valid_when_is_not_none(entityMock: SampleEntity): contract = Contract().is_not_none( entityMock.first_name, "first_name", "any message" ) - assert contract.is_valid() + assert contract.is_valid assert len(contract.get_notifications()) == 0 def test_should_be_invalid_and_return_once_notification_when_not_none(): - contract = Contract().is_not_none(None, "first_name", "any message") - assert contract.is_valid() is False + contract = Contract().is_not_none(None, "first_name", "any message") # type: ignore + assert contract.is_valid is False assert len(contract.get_notifications()) == 1 @@ -112,19 +112,19 @@ def test_should_be_valid_when_is_not_none_or_white_space( contract = Contract().is_not_none_or_white_space( entityMock.first_name, "first_name", "any message" ) - assert contract.is_valid() + assert contract.is_valid assert len(contract.get_notifications()) == 0 def test_should_be_invalid_and_return_once_notification_when_is_none(): - contract = Contract().is_not_none_or_white_space(None, "first_name", "any message") - assert contract.is_valid() is False + contract = Contract().is_not_none_or_white_space(None, "first_name", "any message") # type: ignore + assert contract.is_valid is False assert len(contract.get_notifications()) == 1 def test_should_be_invalid_and_return_once_notification_when_white_space(): contract = Contract().is_not_none_or_white_space(" ", "first_name", "any message") - assert contract.is_valid() is False + assert contract.is_valid is False assert len(contract.get_notifications()) == 1