Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: joke2k/faker
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v37.0.1
Choose a base ref
...
head repository: joke2k/faker
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v37.0.2
Choose a head ref
  • 6 commits
  • 7 files changed
  • 2 contributors

Commits on Mar 18, 2025

  1. fix Belgium IBAN incorrect checksum #2165 (#2175)

    Signed-off-by: xeirzo <>
    
    Signed-off-by: xeirzo <>
    Co-authored-by: xeirzo <>
    xeirzo authored Mar 18, 2025
    Copy the full SHA
    b477867 View commit details
  2. 📝 Update CHANGELOG.md

    fcurella committed Mar 18, 2025
    Copy the full SHA
    2b9f758 View commit details
  3. Copy the full SHA
    327500a View commit details
  4. fix return type

    fcurella committed Mar 18, 2025
    Copy the full SHA
    be6fc5f View commit details

Commits on Mar 19, 2025

  1. 📝 Update CHANGELOG.md

    fcurella committed Mar 19, 2025
    Copy the full SHA
    ada6c54 View commit details
  2. Bump version: 37.0.1 → 37.0.2

    fcurella committed Mar 19, 2025
    Copy the full SHA
    914c19f View commit details
Showing with 21 additions and 13 deletions.
  1. +1 −1 .bumpversion.cfg
  2. +9 −0 CHANGELOG.md
  3. +1 −1 VERSION
  4. +2 −2 docs/conf.py
  5. +1 −1 faker/__init__.py
  6. +3 −3 faker/providers/bank/nl_BE/__init__.py
  7. +4 −5 tests/providers/test_bank.py
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 37.0.0
current_version = 37.0.2
files = VERSION faker/__init__.py docs/conf.py
commit = True
tag = True
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
## Changelog

### [v37.0.2 - 2025-03-19](https://github.com/joke2k/faker/compare/v37.0.1...v37.0.2)

* Fix type annotiation

### [v37.0.1 - 2025-03-18](https://github.com/joke2k/faker/compare/v37.0.0...v37.0.1)

* Fix last names from `en_PK` provider. Thanks @bradenkwebb.
* fix Belgium IBAN incorrect checksum. Thanks @xeirzo.

### [v37.0.0 - 2025-03-07](https://github.com/joke2k/faker/compare/v36.2.3...v37.0.0)

* Fix: `es_ES` `doi()` to use standard DOI format. Thanks @jasur-py.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
37.0.0
37.0.2
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -51,9 +51,9 @@
# built documents.
#
# The short X.Y version.
version = "37.0.0"
version = "37.0.2"
# The full version, including alpha/beta/rc tags.
release = "37.0.0"
release = "37.0.2"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
2 changes: 1 addition & 1 deletion faker/__init__.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@
from faker.generator import Generator
from faker.proxy import Faker

VERSION = "37.0.0"
VERSION = "37.0.2"

__all__ = ("Factory", "Generator", "Faker")
6 changes: 3 additions & 3 deletions faker/providers/bank/nl_BE/__init__.py
Original file line number Diff line number Diff line change
@@ -85,12 +85,12 @@ def _generate_account_number(self) -> str:

def _calculate_mod97(self, account_number: str) -> str:
"""Calculate the mod 97 check digits for a given account number."""
check_digits = 97 - (int(account_number) % 97)
return str(check_digits).zfill(2)
remainder = int(account_number) % 97
return str(remainder).zfill(2) if remainder != 0 else "97"

def _calculate_iban_check_digits(self, bban: str) -> str:
"""Calculate the IBAN check digits using mod 97 algorithm."""
raw_iban = f"{self.country_code}00{bban}"
raw_iban = f"{bban}{self.country_code}00"
numeric_iban = "".join(str(ord(char) - 55) if char.isalpha() else char for char in raw_iban)
check_digits = 98 - (int(numeric_iban) % 97)
return str(check_digits).zfill(2)
9 changes: 4 additions & 5 deletions tests/providers/test_bank.py
Original file line number Diff line number Diff line change
@@ -467,17 +467,16 @@ def test_bban(self, faker, num_samples):
assert re.fullmatch(r"\d{12}", bban)
account_number = bban[:-2]
check_digits = int(bban[-2:])
assert (97 - (int(account_number) % 97)) == check_digits or check_digits == 97
assert (int(account_number) % 97) == check_digits or check_digits == 97

def test_iban(self, faker, num_samples):
for _ in range(num_samples):
iban = faker.iban()
assert iban[:2] == NlBeBankProvider.country_code
assert re.fullmatch(r"\d{2}\d{12}", iban[2:])
bban = iban[4:]
account_number = bban[:-2]
check_digits = int(bban[-2:])
assert (97 - (int(account_number) % 97)) == check_digits or check_digits == 97
rearranged_iban = iban[4:] + iban[:4]
numeric_iban = "".join(str(ord(char) - 55) if char.isalpha() else char for char in rearranged_iban)
assert int(numeric_iban) % 97 == 1

def test_swift8_use_dataset(self, faker, num_samples):
for _ in range(num_samples):