1test_ca_bn.doctest - more detailed doctests for the stdnum.ca.bn module 2 3Copyright (C) 2017 Arthur de Jong 4 5This library is free software; you can redistribute it and/or 6modify it under the terms of the GNU Lesser General Public 7License as published by the Free Software Foundation; either 8version 2.1 of the License, or (at your option) any later version. 9 10This library is distributed in the hope that it will be useful, 11but WITHOUT ANY WARRANTY; without even the implied warranty of 12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13Lesser General Public License for more details. 14 15You should have received a copy of the GNU Lesser General Public 16License along with this library; if not, write to the Free Software 17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 1802110-1301 USA 19 20 21This file contains more detailed doctests for the stdnum.ca.bn module. 22 23>>> from stdnum.ca import bn 24>>> from stdnum.exceptions import * 25 26 27The number can also be a 15-digit account number (Business Number followed by 28program identifier and reference number). 29 30>>> bn.validate('12302 6635') 31'123026635' 32>>> bn.validate('12302 6635 RC 0001') 33'123026635RC0001' 34>>> bn.validate('12302 6635 AA 0001') # only some values allowed 35Traceback (most recent call last): 36 ... 37InvalidComponent: ... 38>>> bn.validate('12302 6635 RC OOO1') # only digits allowed in ref nr 39Traceback (most recent call last): 40 ... 41InvalidFormat: ... 42 43 44These have been found online and should all be valid numbers. 45 46>>> numbers = ''' 47... 48... 000089987RC1818 49... 100007780RC0001 50... 100026723RC0001 51... 100044833RC0001 52... 100060474RC0001 53... 100074699RC0001 54... 100078294RC0002 55... 100080571RC0001 56... 100287119RC0001 57... 100457266RC0001 58... 101007961RC0001 59... 101060390RC0001 60... 123025645RC0001 61... 123026635RC0001 62... 123222911RC0001 63... 123828493RC0001 64... 700706898RC0001 65... 700783491RC0001 66... 700784499RC0001 67... 700803299RC0001 68... 700859895RC0001 69... 702520891RC0001 70... 702521097RC0001 71... 702529496RC0001 72... 702667122RC0001 73... 751055724RC0001 74... 751119520RC0001 75... 751207697RC0001 76... 751369729RC0001 77... 751446725RC0001 78... 751542895RC0001 79... 751551490RC0001 80... 751756529RC0001 81... 752573725RC0001 82... 752574525RC0001 83... 752628297RC0001 84... 752767327RC0001 85... 752768127RC0001 86... 752805291RC0001 87... 752828293RC0001 88... 752860320RC0001 89... 752944892RC0001 90... 753000298RC0001 91... 753371897RC0001 92... 753372291RC0001 93... 753447127RC0001 94... 753461292RC0001 95... 753946698RC0001 96... 789422128RC0001 97... 789482494RC0001 98... 789538923RC0001 99... 789634326RC0001 100... 795578699RC0001 101... 795606490RC0001 102... 795676121RC0001 103... 795710920RC0001 104... 795848126RC0001 105... 795855527RC0001 106... 795930726RC0001 107... 800500001RC0001 108... 800810657RC0001 109... 800812885RC0001 110... 800826489RC0001 111... 800958118RC0001 112... 800973406RC0001 113... 852093749RC0001 114... 852470673RC0001 115... 852581149RC0001 116... 852615772RC0001 117... 852646900RC0001 118... 852694231RC0001 119... 852750546RC0001 120... 852988633RC0001 121... 855065504RC0001 122... 855102976RC0001 123... 855582995RC0001 124... 855643086RC0001 125... 855696373RC0001 126... 855789004RC0001 127... 855957882RC0001 128... 859043580RC0001 129... 859098337RC0001 130... 859144438RC0001 131... 859363848RC0001 132... 859395162RC0001 133... 859457681RC0001 134... 859620973RC0001 135... 892190364RC0001 136... 892220393RC0002 137... 892462672RC0001 138... 892476565RC0001 139... 892552035RC0001 140... 892737149RC0001 141... 892738741RC0001 142... 892807983RC0001 143... 899099733RC0001 144... 899429443RC0001 145... 899549042RC0001 146... 899558340RC0001 147... 899927438RC0001 148... 149... ''' 150>>> [x for x in numbers.splitlines() if x and not bn.is_valid(x)] 151[] 152