diff --git a/clabe/validations.py b/clabe/validations.py index 1a112e5..5783e83 100644 --- a/clabe/validations.py +++ b/clabe/validations.py @@ -76,8 +76,10 @@ class BankConfigRequest(BaseModel): bank_name: str = Field( min_length=1, - strip_whitespace=True, description="Bank name must have at least 1 character.", + json_schema_extra={ + "strip_whitespace": True, + } ) bank_code_banxico: str = Field( diff --git a/tests/test_clabe.py b/tests/test_clabe.py index 140991e..f440d6b 100644 --- a/tests/test_clabe.py +++ b/tests/test_clabe.py @@ -1,3 +1,4 @@ +import warnings import pytest from clabe import ( @@ -55,6 +56,12 @@ def test_add_bank_success(abm_code, banxico_code, name): assert get_bank_name(abm_code) == name +def test_add_bank_no_show_warnings(): + with warnings.catch_warnings(record=True) as caught_warnings: + warnings.simplefilter("always") + add_bank("90716", "Test bank") + assert len(caught_warnings) == 0, "Warnings were emitted during add_bank" + @pytest.mark.parametrize( 'banxico_code, name', [ diff --git a/tests/test_types.py b/tests/test_types.py index 2fa7bb0..1664e7f 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -1,3 +1,4 @@ +import warnings import pytest from pydantic import BaseModel, ValidationError @@ -19,6 +20,12 @@ def test_valid_clabe(): assert cuenta.clabe.bank_code == cuenta.clabe.bank_code_banxico +def test_valid_clabe_shows_no_warnings(): + with warnings.catch_warnings(record=True) as caught_warnings: + warnings.simplefilter("always") + Cuenta(clabe=VALID_CLABE) + assert len(caught_warnings) == 0, "Warnings were emitted during CLABE test" + @pytest.mark.parametrize( 'clabe,expected_message', [