Skip to content
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

Merged
merged 5 commits into from
Apr 20, 2019

Conversation

benkonrath
Copy link
Member

@benkonrath benkonrath commented Apr 18, 2019

I've been meaning to do this for a while. As the code suggests, my plan is to remove the generic.checksums.luhn and generic.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.

@benkonrath benkonrath requested a review from claudep April 18, 2019 14:30


class DeprecatedFieldsTests(SimpleTestCase):
@patch('localflavor.generic.checksums.stdnum_luhn')
Copy link
Member

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?

Copy link
Member

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 :-)

Copy link
Member Author

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.

luhn('1234')

self.assertTrue(all(w.category is RemovedInLocalflavor30Warning for w in recorded))
stdnum_luhn.asert_called_once_with('1234')
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

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-io
Copy link

codecov-io commented Apr 20, 2019

Codecov Report

Merging #370 into master will decrease coverage by 0.05%.
The diff coverage is 90.32%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
localflavor/za/forms.py 100% <100%> (ø) ⬆️
localflavor/generic/validators.py 100% <100%> (ø) ⬆️
localflavor/fr/forms.py 100% <100%> (ø) ⬆️
localflavor/hr/forms.py 94.23% <100%> (ø) ⬆️
localflavor/il/forms.py 100% <100%> (ø) ⬆️
localflavor/ca/forms.py 96.29% <100%> (ø) ⬆️
localflavor/gr/forms.py 90.32% <50%> (ø) ⬆️
localflavor/generic/checksums.py 88.88% <81.81%> (-11.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1936aa...a1a6db0. Read the comment docs.

Copy link
Member

@claudep claudep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@benkonrath benkonrath merged commit 0cbf596 into django:master Apr 20, 2019
@benkonrath benkonrath deleted the python-stdnum branch April 20, 2019 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants