home · contact · privacy
For testing, ignore indentation in <EXPANDED />. master
authorChristian Heller <c.heller@plomlompom.de>
Sun, 25 Jan 2026 07:39:14 +0000 (08:39 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 25 Jan 2026 07:39:14 +0000 (08:39 +0100)
src/ledgplom/testing.py
src/tests/full.edit_structured.1
src/tests/full.edit_structured.4
src/tests/full.edit_structured.5

index dbea8160e05f59856863b9e988bc7df5f29de7a4..5a7263b72a2c7d7580b831fce40bdfd0f87a4e53 100644 (file)
@@ -45,11 +45,13 @@ def run_tests(selector: str) -> None:
                 lines_expected = tuple(line.rstrip('\n')
                                        for line in f.readlines())
             msg_prefix = f'test for {test_path}:'
                 lines_expected = tuple(line.rstrip('\n')
                                        for line in f.readlines())
             msg_prefix = f'test for {test_path}:'
+            in_expansion = False
             for idx0, line in enumerate(lines_expected):
                 idx1 = idx0 + 1
                 if line in _TAGS_EXPANDED:
                     lines_rendered[idx0:idx0] = [line]
             for idx0, line in enumerate(lines_expected):
                 idx1 = idx0 + 1
                 if line in _TAGS_EXPANDED:
                     lines_rendered[idx0:idx0] = [line]
-                    if line[1] != '/':
+                    in_expansion = line[1] != '/'
+                    if in_expansion:
                         lines_rendered[idx1:idx1+1]\
                                 = lines_rendered[idx1].replace('><', '>\n<'
                                                                ).splitlines()
                         lines_rendered[idx1:idx1+1]\
                                 = lines_rendered[idx1].replace('><', '>\n<'
                                                                ).splitlines()
@@ -57,7 +59,8 @@ def run_tests(selector: str) -> None:
                 abort_msg = ''
                 if idx1 > len(lines_rendered):
                     abort_msg = 'more lines expected'
                 abort_msg = ''
                 if idx1 > len(lines_rendered):
                     abort_msg = 'more lines expected'
-                elif lines_rendered[idx0] != line:
+                elif lines_rendered[idx0] != (line.lstrip() if in_expansion
+                                              else line):
                     abort_msg = ('line differs, found instead: '
                                  f'[{lines_rendered[idx0]}]')
                 if abort_msg:
                     abort_msg = ('line differs, found instead: '
                                  f'[{lines_rendered[idx0]}]')
                 if abort_msg:
index f091ec9e0d694330c2aef1424221bf21e25eb3ce..4d9fbb50ea558605908e8daddbd6d159c27462f3 100644 (file)
@@ -104,64 +104,64 @@ to
 <hr>
 <EXPANDED>
 <table id="booking_lines" class="alternating">
 <hr>
 <EXPANDED>
 <table id="booking_lines" class="alternating">
-<tr>
-<td colspan="1">
-</td>
-<td colspan="3">
-<input name="line_0_date" size="10" value="2001-01-01" id="date_input">
-<input name="line_0_target" size="37" value="test">
-</td>
-<td colspan="1">
-<input name="line_0_comment" size="40" value="foo">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button" disabled="">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_1_account" size="30" value="foo" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_1_amount" size="12" value="10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_1_currency" size="3" value="€" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_1_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_2_account" size="30" value="bar" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_2_amount" size="12" value="-10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_2_currency" size="3" value="€" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_2_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
+    <tr>
+        <td colspan="1">
+        </td>
+        <td colspan="3">
+            <input name="line_0_date" size="10" value="2001-01-01" id="date_input">
+            <input name="line_0_target" size="37" value="test">
+        </td>
+        <td colspan="1">
+            <input name="line_0_comment" size="40" value="foo">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button" disabled="">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_1_account" size="30" value="foo" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_1_amount" size="12" value="10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_1_currency" size="3" value="€" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_1_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_2_account" size="30" value="bar" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_2_amount" size="12" value="-10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_2_currency" size="3" value="€" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_2_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
 </table>
 </EXPANDED>
 <div>Gap:</div>
 </table>
 </EXPANDED>
 <div>Gap:</div>
index 7e718189a01357780098a7d4382d46f20ca942aa..262655703bea979ba8d53dee6588300e098e4377 100644 (file)
@@ -104,108 +104,108 @@ to
 <hr>
 <EXPANDED>
 <table id="booking_lines" class="alternating">
 <hr>
 <EXPANDED>
 <table id="booking_lines" class="alternating">
-<tr>
-<td colspan="1">
-</td>
-<td colspan="3">
-<input name="line_0_date" size="10" value="2001-01-03" id="date_input">
-<input name="line_0_target" size="37" value="test">
-</td>
-<td colspan="1">
-<input name="line_0_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button" disabled="">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_1_account" size="30" value="foo:x" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_1_amount" size="12" value="10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_1_currency" size="3" value="€" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_1_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_2_account" size="30" value="foo:x" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_2_amount" size="12" value="1" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_2_currency" size="3" value="USD" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_2_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_3_account" size="30" value="bar:x:y" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_3_amount" size="12" value="-10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_3_currency" size="3" value="€" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_3_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_4_account" size="30" value="bar:z" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_4_amount" size="12" value="-1" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_4_currency" size="3" value="USD" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_4_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
+    <tr>
+        <td colspan="1">
+        </td>
+        <td colspan="3">
+            <input name="line_0_date" size="10" value="2001-01-03" id="date_input">
+            <input name="line_0_target" size="37" value="test">
+        </td>
+        <td colspan="1">
+            <input name="line_0_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button" disabled="">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_1_account" size="30" value="foo:x" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_1_amount" size="12" value="10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_1_currency" size="3" value="€" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_1_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_2_account" size="30" value="foo:x" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_2_amount" size="12" value="1" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_2_currency" size="3" value="USD" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_2_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_3_account" size="30" value="bar:x:y" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_3_amount" size="12" value="-10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_3_currency" size="3" value="€" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_3_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_4_account" size="30" value="bar:z" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_4_amount" size="12" value="-1" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_4_currency" size="3" value="USD" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_4_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
 </table>
 </EXPANDED>
 <div>Gap:</div>
 </table>
 </EXPANDED>
 <div>Gap:</div>
index 1f031eb5ec474392ea75ccf3a8bf40d23ba8323a..b85a6e62e4ef3ca6dde71ae66bd2641206df639a 100644 (file)
@@ -110,108 +110,108 @@ to
 <hr>
 <EXPANDED>
 <table id="booking_lines" class="alternating">
 <hr>
 <EXPANDED>
 <table id="booking_lines" class="alternating">
-<tr>
-<td colspan="1">
-</td>
-<td colspan="3">
-<input name="line_0_date" size="10" value="2001-01-03" id="date_input">
-<input name="line_0_target" size="37" value="test">
-</td>
-<td colspan="1">
-<input name="line_0_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button" disabled="">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_1_account" size="30" value="foo:x" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_1_amount" size="12" value="10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_1_currency" size="3" value="€" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_1_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_2_account" size="30" value="foo:x" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_2_amount" size="12" value="3" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_2_currency" size="3" value="USD" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_2_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_3_account" size="30" value="bar:x:y" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_3_amount" size="12" value="-9" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_3_currency" size="3" value="€" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_3_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
-<tr>
-<td colspan="1">
-<button type="button">^</button>
-<button type="button">v</button>
-</td>
-<td colspan="1">
-<input name="line_4_account" size="30" value="bar:z" list="all_accounts" autocomplete="off">
-</td>
-<td colspan="1">
-<input name="line_4_amount" size="12" value="-1" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
-</td>
-<td colspan="1">
-<input name="line_4_currency" size="3" value="USD" placeholder="€">
-</td>
-<td colspan="1">
-<input name="line_4_comment" size="40" value="">
-</td>
-<td colspan="1">
-<button type="button">add new</button>
-<button type="button">delete</button>
-</td>
-</tr>
+    <tr>
+        <td colspan="1">
+        </td>
+        <td colspan="3">
+            <input name="line_0_date" size="10" value="2001-01-03" id="date_input">
+            <input name="line_0_target" size="37" value="test">
+        </td>
+        <td colspan="1">
+            <input name="line_0_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button" disabled="">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_1_account" size="30" value="foo:x" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_1_amount" size="12" value="10" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_1_currency" size="3" value="€" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_1_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_2_account" size="30" value="foo:x" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_2_amount" size="12" value="3" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_2_currency" size="3" value="USD" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_2_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_3_account" size="30" value="bar:x:y" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_3_amount" size="12" value="-9" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_3_currency" size="3" value="€" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_3_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="1">
+            <button type="button">^</button>
+            <button type="button">v</button>
+        </td>
+        <td colspan="1">
+            <input name="line_4_account" size="30" value="bar:z" list="all_accounts" autocomplete="off">
+        </td>
+        <td colspan="1">
+            <input name="line_4_amount" size="12" value="-1" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+        </td>
+        <td colspan="1">
+            <input name="line_4_currency" size="3" value="USD" placeholder="€">
+        </td>
+        <td colspan="1">
+            <input name="line_4_comment" size="40" value="">
+        </td>
+        <td colspan="1">
+            <button type="button">add new</button>
+            <button type="button">delete</button>
+        </td>
+    </tr>
 </table>
 </EXPANDED>
 <div>Gap:</div>
 </table>
 </EXPANDED>
 <div>Gap:</div>