-
Notifications
You must be signed in to change notification settings - Fork 24
Migrate to Pydantic v2 #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
02458a1
ci: add Codecov token to workflow configuration
fe79bec
feat: add error handling for existing bank codes and names
7ae5528
ci: update GitHub Actions workflow to use new action versions
e2e4cb9
chore: bump version to 1.2.17.dev1
2a4566e
chore: update GitHub Actions workflows for release and testing
b356cd1
fix: update PyPI token reference in GitHub Actions workflow
982d131
fix: update PyPI token reference in release workflow to use PYPI_API_…
5a13284
Merge branch 'chore/update-github-actions' into feature/add-editable-…
cf757b3
refactor: rename and update error classes for bank code validation
04b96f1
feat: add configure_additional_bank function and corresponding tests
b3fc823
docs: update README to include instructions for add a new bank
17056cd
chore: bump version to 1.2.17.dev2
63aa59d
chore: bump version to 1.2.17
8c0a105
chore: update GitHub Actions workflows for release and testing
e7d7e47
fix: update PyPI token reference in GitHub Actions workflow
224adf2
fix: update PyPI token reference in release workflow to use PYPI_API_…
7c03593
refactor: rename and update error classes for bank code validation
eeeaa7d
feat: add configure_additional_bank function and corresponding tests
bab2612
docs: update README to include instructions for add a new bank
4bb61cf
chore: bump version to 1.2.17.dev2
247f3b4
chore: bump version to 1.2.17
4168501
Merge branch 'feature/add-editable-banks-config' of github.com:cuenca…
49d22b8
Merge branch 'main' into feature/add-editable-banks-config
gmorales96 51856ed
feat: enhance configure_additional_bank with input validation
aeace46
chore: update Python version to 3.8, bump pydantic requirement to >=2…
b6d5a98
chore: upgrade Pydantic to v2
007ee9f
docs: update Python version requirement in README
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = '1.2.16' | ||
| __version__ = '2.0.0.dev0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,4 @@ pytest-cov==2.11.* | |
| black==22.3.0 | ||
| isort==5.10.* | ||
| flake8==4.0.* | ||
| mypy==0.790 | ||
| mypy==1.13.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| pydantic==1.9.0 | ||
| pydantic==2.10.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| import pytest | ||
| from pydantic_core import PydanticCustomError | ||
|
|
||
| from clabe import ( | ||
| compute_control_digit, | ||
| configure_additional_bank, | ||
| generate_new_clabes, | ||
| get_bank_name, | ||
| validate_clabe, | ||
|
|
@@ -36,3 +38,35 @@ def test_generate_new_clabes(): | |
| for clabe in clabes: | ||
| assert clabe.startswith(prefix) | ||
| assert validate_clabe(clabe) | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. de preferencia no pongas los cambios del otro branch, para que no genere ruido |
||
|
|
||
| def test_configure_additional_bank_success(): | ||
| configure_additional_bank('777', '713', 'New Bank') | ||
| assert get_bank_name('777') == 'New Bank' | ||
|
|
||
|
|
||
| def test_configure_additional_bank_existing_abm_code(): | ||
| with pytest.raises(PydanticCustomError) as exc_info: | ||
| configure_additional_bank('002', '40002', 'Banamex') | ||
| assert exc_info.value.type == 'clabe.bank_code_abm' | ||
| assert 'código de banco ABM ya existe' in str(exc_info.value) | ||
|
|
||
|
|
||
| def test_configure_additional_bank_existing_banxico_code(): | ||
| with pytest.raises(PydanticCustomError) as exc_info: | ||
| configure_additional_bank('666', '40137', 'New Bank') | ||
| assert exc_info.value.type == 'clabe.bank_code_banxico' | ||
| assert 'código de banco banxico ya existe' in str(exc_info.value) | ||
|
|
||
|
|
||
| def test_configure_additional_bank_invalid_inputs(): | ||
| with pytest.raises(TypeError): | ||
| configure_additional_bank(3, 3, 3) | ||
| with pytest.raises(TypeError): | ||
| configure_additional_bank('A', 'B', 'C') | ||
| with pytest.raises(TypeError): | ||
| configure_additional_bank('666', 'B', 'C') | ||
| with pytest.raises(ValueError): | ||
| configure_additional_bank('777', '713', '') | ||
| with pytest.raises(TypeError): | ||
| configure_additional_bank('abc', 'def', 'Test Bank') | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agregar las versiones hasta la 3.13