-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix of issue 0203. If the person is more that 100 years old the year …
…number in not computed correctly and an exception is raised. The fix attempt several time (3) to use the correct number until the exception is not raised
- Loading branch information
Michele Faedi
committed
Nov 22, 2024
1 parent
de8018d
commit d56d0c4
Showing
2 changed files
with
41 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import unittest | ||
from datetime import datetime, timedelta | ||
|
||
from codicefiscale import codicefiscale | ||
|
||
|
||
class Issue0203TestCase(unittest.TestCase): | ||
def test_issue_0203(self): | ||
""" | ||
Encode a person in an old municipality (active = false) | ||
And the person is more than 100 years old | ||
""" | ||
try: | ||
codicefiscale.encode('Mario', 'Rossi', 'm', datetime.now() - timedelta(days=150 * 365), 'Gallico') | ||
except ValueError as e: | ||
self.fail(f"codicefiscale.encode raised an exception: {e}") |