|
| 1 | +test_id_npwp.doctest - more detailed doctests for stdnum.id.npwp module |
| 2 | + |
| 3 | +Copyright (C) 2020 Leandro Regueiro |
| 4 | + |
| 5 | +This library is free software; you can redistribute it and/or |
| 6 | +modify it under the terms of the GNU Lesser General Public |
| 7 | +License as published by the Free Software Foundation; either |
| 8 | +version 2.1 of the License, or (at your option) any later version. |
| 9 | + |
| 10 | +This library is distributed in the hope that it will be useful, |
| 11 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | +Lesser General Public License for more details. |
| 14 | + |
| 15 | +You should have received a copy of the GNU Lesser General Public |
| 16 | +License along with this library; if not, write to the Free Software |
| 17 | +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 18 | +02110-1301 USA |
| 19 | + |
| 20 | + |
| 21 | +This file contains more detailed doctests for the stdnum.id.npwp module. It |
| 22 | +tries to test more corner cases and detailed functionality that is not really |
| 23 | +useful as module documentation. |
| 24 | + |
| 25 | +>>> from stdnum.id import npwp |
| 26 | + |
| 27 | + |
| 28 | +Tests for some corner cases. |
| 29 | + |
| 30 | +>>> npwp.validate('023869720091000') |
| 31 | +'023869720091000' |
| 32 | +>>> npwp.validate('01.451.869.0-054.000') |
| 33 | +'014518690054000' |
| 34 | +>>> npwp.validate('02 . 433 . 917 . 8 - 011 . 000') |
| 35 | +'024339178011000' |
| 36 | +>>> npwp.format('013319595054000') |
| 37 | +'01.331.959.5-054.000' |
| 38 | +>>> npwp.validate('12345678901234') |
| 39 | +Traceback (most recent call last): |
| 40 | + ... |
| 41 | +InvalidLength: ... |
| 42 | +>>> npwp.validate('FF3456789012345') |
| 43 | +Traceback (most recent call last): |
| 44 | + ... |
| 45 | +InvalidFormat: ... |
| 46 | +>>> npwp.validate('01.451.869.7-054.000') |
| 47 | +Traceback (most recent call last): |
| 48 | + ... |
| 49 | +InvalidChecksum: ... |
| 50 | + |
| 51 | + |
| 52 | +These have been found online and should all be valid numbers. |
| 53 | + |
| 54 | +>>> numbers = ''' |
| 55 | +... |
| 56 | +... 01.001.610.3-051.000 |
| 57 | +... 01.001.634.3-093.000 |
| 58 | +... 01.105.197.6-424.000 |
| 59 | +... 01.112.397.3-441.000 |
| 60 | +... 01.125.612.0-805.000 |
| 61 | +... 01.129.154.9-201.000 |
| 62 | +... 01.216.271.5-441.000 |
| 63 | +... 01.258.022.1-201.000 |
| 64 | +... 01.268.426.2-201.000 |
| 65 | +... 01.311.830.2-073.000 |
| 66 | +... 01.318.451.0-054.000 |
| 67 | +... 01.334.427.0-054.000 |
| 68 | +... 01.347.428.3-018.000 |
| 69 | +... 01.360.902.9-054.000 |
| 70 | +... 01.436.246.1-441.000 |
| 71 | +... 01.452.340.1-101.000 |
| 72 | +... 01.455.616.1-441.000 |
| 73 | +... 01.457.751.4-426.000 |
| 74 | +... 01.464.753.1-542.000 |
| 75 | +... 01.482.738.0-424.000 |
| 76 | +... 01.504.513.1-054.000 |
| 77 | +... 01.546.704.6-012.000 |
| 78 | +... 01.546.836.6-013.000 |
| 79 | +... 01.548.436.3-423.000 |
| 80 | +... 01.555.547.7-429.000 |
| 81 | +... 01.562.420.8-805.000 |
| 82 | +... 01.575.888.1-101.000 |
| 83 | +... 01.580.769.6-201.000 |
| 84 | +... 01.627.251.0-404.000 |
| 85 | +... 01.657.878.3-101.000 |
| 86 | +... 01.671.242.4-054.000 |
| 87 | +... 01.677.930.8-429.000 |
| 88 | +... 01.690.679.4-801.000 |
| 89 | +... 01.709.626.4-054.000 |
| 90 | +... 01.721.123.6-054.000 |
| 91 | +... 01.773.770.1-805.000 |
| 92 | +... 01.796.259.8-805.000 |
| 93 | +... 01.815.656.2-807.000 |
| 94 | +... 01.931.919.3-101.000 |
| 95 | +... 01.966.099.2-801.000 |
| 96 | +... 01.997.870.9-038.000 |
| 97 | +... 010692903641000 |
| 98 | +... 017048299643001 |
| 99 | +... 02.037.103.5-502.000 |
| 100 | +... 02.071.326.9-101.000 |
| 101 | +... 02.071.363.2-101.000 |
| 102 | +... 02.081.228.5-424.000 |
| 103 | +... 02.098.700.4-013.000 |
| 104 | +... 02.098.788.9-013.000 |
| 105 | +... 02.102.011.0-101.000 |
| 106 | +... 02.151.039.1-106.000 |
| 107 | +... 02.173.740.8-002.000 |
| 108 | +... 02.203.654.5-429.000 |
| 109 | +... 02.333.122.6-441.000 |
| 110 | +... 02.367.986.3-426.000 |
| 111 | +... 02.399.244.9-091.000 |
| 112 | +... 02.446.000.8-429.000 |
| 113 | +... 02.480.884.2-444.000 |
| 114 | +... 02.504.191.4-054.000 |
| 115 | +... 02.527.123.0-017.000 |
| 116 | +... 02.547.885.0-805.000 |
| 117 | +... 02.564.234.9-421.000 |
| 118 | +... 02.585.033.0-216.000 |
| 119 | +... 02.643.101.5-805.000 |
| 120 | +... 02.650.677.4-101.000 |
| 121 | +... 02.679.257.2-801.000 |
| 122 | +... 02.719.242.6-106.000 |
| 123 | +... 02.755.249.6-541.000 |
| 124 | +... 02.790.820.1-428.000 |
| 125 | +... 02.887.783.5-105.000 |
| 126 | +... 02.910.648.1-805.000 |
| 127 | +... 02.932.094.2-101.000 |
| 128 | +... 02.956.222.0-106.000 |
| 129 | +... 02.956.223.8-106.000 |
| 130 | +... 02.972.041.4-428.000 |
| 131 | +... 02.976.331.5-103.000 |
| 132 | +... 02.984.042.8-201.000 |
| 133 | +... 03.026.787.6-805.000 |
| 134 | +... 03.195.088.4-801.000 |
| 135 | +... 03.217.024.3-805.000 |
| 136 | +... 21.078.367.6-424.000 |
| 137 | +... 31.294.519.9-424.000 |
| 138 | +... 31.470.209.3-428.000 |
| 139 | +... 31.496.676.3-106.000 |
| 140 | +... 31.578.913.1-201.000 |
| 141 | +... 31.682.116.4-201.000 |
| 142 | +... 31.696.264.6-201.000 |
| 143 | +... 31.729.429.6-542.000 |
| 144 | +... 66.487.591.1-071.000 |
| 145 | +... 70.838.297.3-201.000 |
| 146 | +... 71.269.216.9-203.000 |
| 147 | +... 75.193.535.4-805.000 |
| 148 | +... 755023033513000 |
| 149 | +... 762278075077000 |
| 150 | +... 764038907023000 |
| 151 | +... 811145994124000 |
| 152 | +... 813195435017000 |
| 153 | +... 83.132.665.7-201.000 |
| 154 | +... 84.054.217.9-609.000 |
| 155 | +... 846150324629000 |
| 156 | +... 90.004.581.6-201.000 |
| 157 | +... |
| 158 | +... ''' |
| 159 | +>>> [x for x in numbers.splitlines() if x and not npwp.is_valid(x)] |
| 160 | +[] |
0 commit comments