|
| 1 | +test_fr_tva.doctest - more detailed doctests for the stdnum.fr.tva module |
| 2 | + |
| 3 | +Copyright (C) 2025 Fabien Michel |
| 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.fr.tva module. |
| 22 | + |
| 23 | +>>> from stdnum.fr import tva |
| 24 | +>>> from stdnum.exceptions import * |
| 25 | + |
| 26 | + |
| 27 | +>>> tva.validate('Fr 40 303 265 045') |
| 28 | +'40303265045' |
| 29 | +>>> tva.validate('23 334 175 221') |
| 30 | +'23334175221' |
| 31 | +>>> tva.validate('23334175221') |
| 32 | +'23334175221' |
| 33 | +>>> tva.validate('84 323 140 391') |
| 34 | +Traceback (most recent call last): |
| 35 | + ... |
| 36 | +InvalidChecksum: ... |
| 37 | +>>> tva.to_siren('Fr 40 303 265 045') |
| 38 | +'303265045' |
| 39 | +>>> tva.to_siren('23 334 175 221') |
| 40 | +'334175221' |
| 41 | +>>> tva.to_siren('FR 53 0000 04605') # Monaco VAT code canot be converted |
| 42 | +Traceback (most recent call last): |
| 43 | + ... |
| 44 | +InvalidComponent: ... |
0 commit comments