lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.6-7-g81446fd

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.6-7-g81446fd



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  81446fd2d42190cd35f5055f9e7792ee432ec602 (commit)
       via  ed9ac5b1051f02e50c1f59fa3f2c235611923809 (commit)
      from  57c12d816bcf324b14cb2dc7f8b284400c075591 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=81446fd2d42190cd35f5055f9e7792ee432ec602

commit 81446fd2d42190cd35f5055f9e7792ee432ec602
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Fri Jun 2 11:36:30 2017 +0200

    Use slightly more compact code
    
    This changes the alphanumeric to numeric translation to be slightly more
    compact and slightly faster.

diff --git a/stdnum/iso7064/mod_97_10.py b/stdnum/iso7064/mod_97_10.py
index 39f05c4..606e4ac 100644
--- a/stdnum/iso7064/mod_97_10.py
+++ b/stdnum/iso7064/mod_97_10.py
@@ -37,15 +37,11 @@ valid if the number modulo 97 is 1. As such it has two 
check digits.
 from stdnum.exceptions import *
 
 
-# the valid characters we have
-_alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
-
 def _to_base10(number):
     """Prepare the number to its base10 representation."""
     try:
         return ''.join(
-            str(_alphabet.index(x)) for x in number)
+            str(int(x, 36)) for x in number)
     except Exception:
         raise InvalidFormat()
 

https://arthurdejong.org/git/python-stdnum/commit/?id=ed9ac5b1051f02e50c1f59fa3f2c235611923809

commit ed9ac5b1051f02e50c1f59fa3f2c235611923809
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Apr 16 18:56:18 2017 +0200

    Add a few ISBNs found online
    
    This adds a number of ISBNs found online from various sources to the
    test suite.

diff --git a/tests/test_isbn.doctest b/tests/test_isbn.doctest
index 7d0c7f6..954e519 100644
--- a/tests/test_isbn.doctest
+++ b/tests/test_isbn.doctest
@@ -101,3 +101,213 @@ Regrouping tests.
 ('979', '', '', '201234567', '8')
 >>> isbn.split('5413170121522')  # valid checkdigit, unknown prefix
 ('', '', '', '541317012152', '2')
+
+
+These have been found online and should all be valid numbers.
+
+>>> numbers = '''
+...
+... 0-19-963209-X
+... 0-201-75041-4
+... 0-7503-0197-X
+... 0-7506-9275-8
+... 0-8412-0473-X
+... 0-8493-0464-4
+... 0-8493-0504-7
+... 0080423906
+... 013036004X
+... 2-225-30547-1
+... 9284401348
+... 978-1-4200-4561-1
+... 978-1-4200-8032-2
+... 978-1-4397-3244-1
+... 978-1-4398-2494-8
+... 978-1-4398-8929-9
+... 978-1-55156-438-8
+... 978-90-208-3866-4
+... 978-90-208-5330-8
+... 978-90-345-0790-7
+... 978-90-345-1183-6
+... 978-90-345-1341-0
+... 978-90-345-2135-4
+... 978-90-345-2248-1
+... 978-90-345-3025-7
+... 978-90-345-3239-8
+... 978-90-345-3629-7
+... 978-90-345-4767-5
+... 978-90-345-4770-5
+... 978-90-345-4934-1
+... 978-90-345-5216-7
+... 978-90-345-5632-5
+... 978-90-345-6767-3
+... 978-963-88880-5-1
+... 9780 8872 76743
+... 9780231501132
+... 9780231506236
+... 9780231507387
+... 9780231508360
+... 9780231527682
+... 9780252092022
+... 9780271055206
+... 9780271055480
+... 9780271056289
+... 9780292717664
+... 9780292752252
+... 9780300058024
+... 9780300091960
+... 9780300097474
+... 9780300110654
+... 9780300115406
+... 9780300133523
+... 9780300156263
+... 9780470010037
+... 9780470012536
+... 9780470026977
+... 9780470027257
+... 9780470027424
+... 9780470058084
+... 9780470149676
+... 9780470180907
+... 9780470317372
+... 9780470358139
+... 9780470358184
+... 9780470358849
+... 9780470519578
+... 9780470706459
+... 9780470707296
+... 9780470723807
+... 9780470757659
+... 9780470760123
+... 9780470773154
+... 9780470774618
+... 9780470841785
+... 9780470863343
+... 9780470869697
+... 9780470987056
+... 9780470996027
+... 9780471024033
+... 9780471206910
+... 9780471221951
+... 9780471444541
+... 9780471445340
+... 9780471619772
+... 9780471623793
+... 9780471713425
+... 9780471718161
+... 9780471723950
+... 9780471740452
+... 9780471790594
+... 9780520205802
+... 9780520217676
+... 9780520230453
+... 9780520238879
+... 9780520238961
+... 9780520244306
+... 9780520255791
+... 9780520911543
+... 9780520928572
+... 9780520937529
+... 9780520939431
+... 9780520939769
+... 9780520945227
+... 9780520945821
+... 9780631211532
+... 9780631224068
+... 9780631225799
+... 9780632038961
+... 9780674061910
+... 9780727917867
+... 9780748621651
+... 9780748625208
+... 9780748633340
+... 9780773506688
+... 9780773528499
+... 9780773528673
+... 9780773530843
+... 9780773563438
+... 9780773563629
+... 9780773566217
+... 9780773567221
+... 9780773570498
+... 9780773572966
+... 9780773574533
+... 9780773582712
+... 9780773587861
+... 9780801447518
+... 9780801467677
+... 9780802009685
+... 9780802043108
+... 9780802078636
+... 9780802081544
+... 9780802088161
+... 9780802096456
+... 9780807845837
+... 9780807871584
+... 9780807871935
+... 9780807872192
+... 9780815730347
+... 9780816604777
+... 9780816606597
+... 9780816647774
+... 9780816655281
+... 9780816659760
+... 9780816665976
+... 9780816681600
+... 9780833035202
+... 9780833048646
+... 9780833059949
+... 9780833077851
+... 9780871545183
+... 9781111525545
+... 9781400821600
+... 9781400822232
+... 9781400826414
+... 9781400828623
+... 9781400828647
+... 9781400840861
+... 9781400842483
+... 9781400845934
+... 9781405131902
+... 9781405175791
+... 9781442602380
+... 9781442612877
+... 9781442613140
+... 9781442641198
+... 9781442644335
+... 9781442670174
+... 9781442670747
+... 9781442674202
+... 9781442685376
+... 9781442688636
+... 9781442693517
+... 9781442696716
+... 9781469606309
+... 9781571136329
+... 9781571138392
+... 9781610447775
+... 9781846156243
+... 9783527283217
+... 9783527298365
+... 9783527305797
+... 9783527307258
+... 9783527311125
+... 9783527406371
+... 9783527602803
+... 9783527604296
+... 9783527606757
+... 9783527615186
+... 9783527615759
+... 9783527619771
+... 9783527621781
+... 9783826334054
+... 9789622091252
+... 9789622099760
+... 9789814319089
+... 9789888052509
+... 9789888139590
+... 981-02-1046-9
+... 9814 253065
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and not isbn.is_valid(x)]
+[]

-----------------------------------------------------------------------

Summary of changes:
 stdnum/iso7064/mod_97_10.py |   6 +-
 tests/test_isbn.doctest     | 210 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 211 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
python-stdnum
-- 
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
https://lists.arthurdejong.org/python-stdnum-commits/