handelsregister

command line interface for handelsregister.de
git clone https://git.ce9e.org/handelsregister.git

commit
7b87841c6bbb95061324310ecf585d6848655b56
parent
830793fb7a4443a8b424fc40eb2d5a8d699927fc
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-12-11 00:01
add some tests

Diffstat

A tests.py 32 ++++++++++++++++++++++++++++++++

1 files changed, 32 insertions, 0 deletions


diff --git a/tests.py b/tests.py

@@ -0,0 +1,32 @@
   -1     1 import unittest
   -1     2 
   -1     3 from handelsregister import parse_id
   -1     4 
   -1     5 
   -1     6 class DummyContext:
   -1     7     def __getitem__(self, key):
   -1     8         return key
   -1     9 
   -1    10 
   -1    11 class ParseIDTest(unittest.TestCase):
   -1    12     def _test(self, s, data):
   -1    13         ctx = {'rev_courts': DummyContext()}
   -1    14         self.assertEqual(parse_id(s, ctx), data)
   -1    15 
   -1    16     def test_vr(self):
   -1    17         self._test(
   -1    18             'Amtsgericht Bonn VR 5752',
   -1    19             {'court': 'Bonn', 'reg': 'VR', 'id': '5752'},
   -1    20         )
   -1    21 
   -1    22     def test_hrb(self):
   -1    23         self._test(
   -1    24             'Amtsgericht Berlin (Charlottenburg) HRB 61732',
   -1    25             {'court': 'Berlin (Charlottenburg)', 'reg': 'HRB', 'id': '61732'},
   -1    26         )
   -1    27 
   -1    28     def test_formerly(self):
   -1    29         self._test(
   -1    30             'Amtsgericht Hamm VR 10190 früher Amtsgericht Kamen',
   -1    31             {'court': 'Hamm', 'reg': 'VR', 'id': '10190'},
   -1    32         )