-
Notifications
You must be signed in to change notification settings - Fork 295
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
Deprecate generic.checksums.luhn and ean #370
Conversation
tests/test_deprecated.py
Outdated
|
||
|
||
class DeprecatedFieldsTests(SimpleTestCase): | ||
@patch('localflavor.generic.checksums.stdnum_luhn') |
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.
Not sure, what is the role of patch here?
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.
Oh, for the assertion below? All that just for testing a deprecation. I wouldn't have moaned if you omitted that :-)
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.
I agree it's a bit pedantic - thanks for pointing this out. Removing these tests also means I can remove the additional requirement for mock on Python 2 which simplifies things a bit.
tests/test_deprecated.py
Outdated
luhn('1234') | ||
|
||
self.assertTrue(all(w.category is RemovedInLocalflavor30Warning for w in recorded)) | ||
stdnum_luhn.asert_called_once_with('1234') |
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.
Strange that the tests don't fail with the typ0 asert
vs assert
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.
That's mock - it silently allows undefined methods to be called without raising an error.
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.
By the way - nice catch! :-)
Codecov Report
@@ Coverage Diff @@
## master #370 +/- ##
==========================================
- Coverage 96% 95.95% -0.06%
==========================================
Files 160 160
Lines 4058 4051 -7
Branches 528 525 -3
==========================================
- Hits 3896 3887 -9
- Misses 98 99 +1
- Partials 64 65 +1
Continue to review full report at Codecov.
|
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.
Good job!
I've been meaning to do this for a while. As the code suggests, my plan is to remove the
generic.checksums.luhn
andgeneric.checksums.ean
functions in 3.0 - users should just use python-stdnum directly.@claudep If you have time a review and your thoughts on this plan would be helpful. Thanks.