lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.0-9-gc334bcf

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

python-stdnum branch master updated. 1.0-9-gc334bcf



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  c334bcf616e1c582dec1a3c2f2fe45afa902755d (commit)
      from  84620f864b4c13627edc0f1c71ec43b8fec54f65 (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 -----------------------------------------------------------------
http://arthurdejong.org/git/python-stdnum/commit/?id=c334bcf616e1c582dec1a3c2f2fe45afa902755d

commit c334bcf616e1c582dec1a3c2f2fe45afa902755d
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sat Apr 18 15:29:46 2015 +0200

    Add more tests for Kennitala

diff --git a/stdnum/is_/kennitala.py b/stdnum/is_/kennitala.py
index 5e8bab6..39aaf6e 100644
--- a/stdnum/is_/kennitala.py
+++ b/stdnum/is_/kennitala.py
@@ -36,6 +36,8 @@ InvalidChecksum: ...
 Traceback (most recent call last):
     ...
 InvalidComponent: ...
+>>> format('1201743399')
+'120174-3399'
 """
 
 import re
diff --git a/tests/test_is_kennitala.doctest b/tests/test_is_kennitala.doctest
new file mode 100644
index 0000000..00ec7cd
--- /dev/null
+++ b/tests/test_is_kennitala.doctest
@@ -0,0 +1,48 @@
+test_is_kennitala.doctest - more detailed doctests stdnum.is_.kennitala
+
+Copyright (C) 2015 Arthur de Jong
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+
+This file contains more detailed doctests for the stdnum.is_.kennitala
+module.
+
+>>> from stdnum.is_ import kennitala
+>>> from stdnum.exceptions import *
+
+
+These have been found online and should all be valid numbers.
+
+>>> numbers = '''
+...
+... 020884-2749
+... 2607565169
+... 4406032540
+... 450401-3150
+... 480408-0550
+... 4905891209
+... 5609091440
+... 580169-1559
+... 580607-0710
+... 641005-1340
+... 670901-2110
+... 670906-0190
+... 7003090610
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and not kennitala.is_valid(x)]
+[]

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

Summary of changes:
 stdnum/is_/kennitala.py                            |    2 +
 ...obustness.doctest => test_is_kennitala.doctest} |   46 +++++++++++++-------
 2 files changed, 32 insertions(+), 16 deletions(-)
 copy tests/{test_robustness.doctest => test_is_kennitala.doctest} (52%)


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