GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python-stdnum/tests/test_ca_bn.doctest at master · unho/python-stdnum

Expand file tree

/

test_ca_bn.doctest

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
151 lines (138 loc) · 3.52 KB
/

test_ca_bn.doctest

Copy path

File metadata and controls

151 lines (138 loc) · 3.52 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
test_ca_bn.doctest - more detailed doctests for the stdnum.ca.bn module
Copyright (C) 2017 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.ca.bn module.
>>> from stdnum.ca import bn
>>> from stdnum.exceptions import *
The number can also be a 15-digit account number (Business Number followed by
program identifier and reference number).
>>> bn.validate('12302 6635')
'123026635'
>>> bn.validate('12302 6635 RC 0001')
'123026635RC0001'
>>> bn.validate('12302 6635 AA 0001') # only some values allowed
Traceback (most recent call last):
...
InvalidComponent: ...
>>> bn.validate('12302 6635 RC OOO1') # only digits allowed in ref nr
Traceback (most recent call last):
...
InvalidFormat: ...
These have been found online and should all be valid numbers.
>>> numbers = '''
...
... 000089987RC1818
... 100007780RC0001
... 100026723RC0001
... 100044833RC0001
... 100060474RC0001
... 100074699RC0001
... 100078294RC0002
... 100080571RC0001
... 100287119RC0001
... 100457266RC0001
... 101007961RC0001
... 101060390RC0001
... 123025645RC0001
... 123026635RC0001
... 123222911RC0001
... 123828493RC0001
... 700706898RC0001
... 700783491RC0001
... 700784499RC0001
... 700803299RC0001
... 700859895RC0001
... 702520891RC0001
... 702521097RC0001
... 702529496RC0001
... 702667122RC0001
... 751055724RC0001
... 751119520RC0001
... 751207697RC0001
... 751369729RC0001
... 751446725RC0001
... 751542895RC0001
... 751551490RC0001
... 751756529RC0001
... 752573725RC0001
... 752574525RC0001
... 752628297RC0001
... 752767327RC0001
... 752768127RC0001
... 752805291RC0001
... 752828293RC0001
... 752860320RC0001
... 752944892RC0001
... 753000298RC0001
... 753371897RC0001
... 753372291RC0001
... 753447127RC0001
... 753461292RC0001
... 753946698RC0001
... 789422128RC0001
... 789482494RC0001
... 789538923RC0001
... 789634326RC0001
... 795578699RC0001
... 795606490RC0001
... 795676121RC0001
... 795710920RC0001
... 795848126RC0001
... 795855527RC0001
... 795930726RC0001
... 800500001RC0001
... 800810657RC0001
... 800812885RC0001
... 800826489RC0001
... 800958118RC0001
... 800973406RC0001
... 852093749RC0001
... 852470673RC0001
... 852581149RC0001
... 852615772RC0001
... 852646900RC0001
... 852694231RC0001
... 852750546RC0001
... 852988633RC0001
... 855065504RC0001
... 855102976RC0001
... 855582995RC0001
... 855643086RC0001
... 855696373RC0001
... 855789004RC0001
... 855957882RC0001
... 859043580RC0001
... 859098337RC0001
... 859144438RC0001
... 859363848RC0001
... 859395162RC0001
... 859457681RC0001
... 859620973RC0001
... 892190364RC0001
... 892220393RC0002
... 892462672RC0001
... 892476565RC0001
... 892552035RC0001
... 892737149RC0001
... 892738741RC0001
... 892807983RC0001
... 899099733RC0001
... 899429443RC0001
... 899549042RC0001
... 899558340RC0001
... 899927438RC0001
...
... '''
>>> [x for x in numbers.splitlines() if x and not bn.is_valid(x)]
[]
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.