home · contact · privacy
For testing comparisons, fix JS-generated HTML all crammed into single line. master
authorChristian Heller <c.heller@plomlompom.de>
Fri, 23 Jan 2026 00:57:18 +0000 (01:57 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 23 Jan 2026 00:57:18 +0000 (01:57 +0100)
src/ledgplom/testing.py
src/tests/full.edit_structured.1
src/tests/full.edit_structured.4

index beb83c934330fbdd6cb4ff4eac28205317a6d659..91ea595bb80ebe78d33efc6a717b7c3e98d5756d 100644 (file)
@@ -13,6 +13,7 @@ from plomlib.web import PlomHttpServer
 
 _EXT_DAT = '.dat'
 _PATH_TESTS = Path('tests')
+_TAGS_EXPANDED = ('<EXPANDED>', '</EXPANDED')
 
 
 def run_tests() -> None:
@@ -41,18 +42,25 @@ def run_tests() -> None:
                 lines_expected = tuple(line.rstrip('\n')
                                        for line in f.readlines())
             msg_prefix = f'test for {test_path}:'
-            for idx0, line in enumerate(lines_rendered):
+            for idx0, line in enumerate(lines_expected):
                 idx1 = idx0 + 1
+                if line in _TAGS_EXPANDED:
+                    lines_rendered[idx0:idx0] = [line]
+                    if line[1] != '/':
+                        lines_rendered[idx1:idx1+1]\
+                                = lines_rendered[idx1].replace('><', '>\n<'
+                                                               ).splitlines()
+                    continue
                 abort_msg = ''
-                if idx1 > len(lines_expected):
-                    abort_msg = f'only {idx0} lines expected'
-                elif lines_expected[idx0] != line:
-                    abort_msg = ('line differs, expected: '
-                                 f'[{lines_expected[idx0]}]')
+                if idx1 > len(lines_rendered):
+                    abort_msg = 'more lines expected'
+                elif lines_rendered[idx0] != line:
+                    abort_msg = ('line differs, found instead: '
+                                 f'[{lines_rendered[idx0]}]')
                 if abort_msg:
                     fail(abort_msg, msg_prefix, idx1)
-            if len(lines_expected) > idx1:
-                fail(f'more lines expected line {idx1}', msg_prefix, None)
+            if len(lines_rendered) > idx1:
+                fail('more lines rendered', msg_prefix, None)
             print(f'{msg_prefix} passed')
         pw.stop()
         server.shutdown()
index 6e525d71ed4fffd466f21a7d7287343ddef4c3c7..9faa0c63ee3d9dc643080ffd3841d76c774f1dae 100644 (file)
@@ -102,7 +102,68 @@ to
 <input id="replace_to">
 </span>
 <hr>
-<table id="booking_lines" class="alternating"><tr><td colspan="1"></td><td colspan="3"><input name="line_0_date" size="10" id="date_input"><input name="line_0_target" size="37"></td><td colspan="1"><input name="line_0_comment" size="40"></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" list="all_accounts" autocomplete="off"></td><td colspan="1"><input name="line_1_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount"></td><td colspan="1"><input name="line_1_currency" size="3" placeholder="€"></td><td colspan="1"><input name="line_1_comment" size="40"></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" list="all_accounts" autocomplete="off"></td><td colspan="1"><input name="line_2_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount"></td><td colspan="1"><input name="line_2_currency" size="3" placeholder="€"></td><td colspan="1"><input name="line_2_comment" size="40"></td><td colspan="1"><button type="button">add new</button><button type="button">delete</button></td></tr></table>
+<EXPANDED>
+<table id="booking_lines" class="alternating">
+<tr>
+<td colspan="1">
+</td>
+<td colspan="3">
+<input name="line_0_date" size="10" id="date_input">
+<input name="line_0_target" size="37">
+</td>
+<td colspan="1">
+<input name="line_0_comment" size="40">
+</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" list="all_accounts" autocomplete="off">
+</td>
+<td colspan="1">
+<input name="line_1_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+</td>
+<td colspan="1">
+<input name="line_1_currency" size="3" placeholder="€">
+</td>
+<td colspan="1">
+<input name="line_1_comment" size="40">
+</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" list="all_accounts" autocomplete="off">
+</td>
+<td colspan="1">
+<input name="line_2_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+</td>
+<td colspan="1">
+<input name="line_2_currency" size="3" placeholder="€">
+</td>
+<td colspan="1">
+<input name="line_2_comment" size="40">
+</td>
+<td colspan="1">
+<button type="button">add new</button>
+<button type="button">delete</button>
+</td>
+</tr>
+</table>
+</EXPANDED>
 <div>Gap:</div>
 <textarea id="gap_lines" name="raw_lines" cols="100" rows="2" class="tainter"></textarea>
 </form>
index 3e79ac695b7c90ac9784f05aef795b8db04d2c3c..9df28c9fea9b3fbb8e2b758194f8f3a76502981d 100644 (file)
@@ -108,7 +108,112 @@ to
 <input id="replace_to">
 </span>
 <hr>
-<table id="booking_lines" class="alternating"><tr><td colspan="1"></td><td colspan="3"><input name="line_0_date" size="10" id="date_input"><input name="line_0_target" size="37"></td><td colspan="1"><input name="line_0_comment" size="40"></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" list="all_accounts" autocomplete="off"></td><td colspan="1"><input name="line_1_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount"></td><td colspan="1"><input name="line_1_currency" size="3" placeholder="€"></td><td colspan="1"><input name="line_1_comment" size="40"></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" list="all_accounts" autocomplete="off"></td><td colspan="1"><input name="line_2_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount"></td><td colspan="1"><input name="line_2_currency" size="3" placeholder="€"></td><td colspan="1"><input name="line_2_comment" size="40"></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" list="all_accounts" autocomplete="off"></td><td colspan="1"><input name="line_3_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount"></td><td colspan="1"><input name="line_3_currency" size="3" placeholder="€"></td><td colspan="1"><input name="line_3_comment" size="40"></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" list="all_accounts" autocomplete="off"></td><td colspan="1"><input name="line_4_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount"></td><td colspan="1"><input name="line_4_currency" size="3" placeholder="€"></td><td colspan="1"><input name="line_4_comment" size="40"></td><td colspan="1"><button type="button">add new</button><button type="button">delete</button></td></tr></table>
+<EXPANDED>
+<table id="booking_lines" class="alternating">
+<tr>
+<td colspan="1">
+</td>
+<td colspan="3">
+<input name="line_0_date" size="10" id="date_input">
+<input name="line_0_target" size="37">
+</td>
+<td colspan="1">
+<input name="line_0_comment" size="40">
+</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" list="all_accounts" autocomplete="off">
+</td>
+<td colspan="1">
+<input name="line_1_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+</td>
+<td colspan="1">
+<input name="line_1_currency" size="3" placeholder="€">
+</td>
+<td colspan="1">
+<input name="line_1_comment" size="40">
+</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" list="all_accounts" autocomplete="off">
+</td>
+<td colspan="1">
+<input name="line_2_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+</td>
+<td colspan="1">
+<input name="line_2_currency" size="3" placeholder="€">
+</td>
+<td colspan="1">
+<input name="line_2_comment" size="40">
+</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" list="all_accounts" autocomplete="off">
+</td>
+<td colspan="1">
+<input name="line_3_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+</td>
+<td colspan="1">
+<input name="line_3_currency" size="3" placeholder="€">
+</td>
+<td colspan="1">
+<input name="line_3_comment" size="40">
+</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" list="all_accounts" autocomplete="off">
+</td>
+<td colspan="1">
+<input name="line_4_amount" size="12" pattern="^-?[0-9]+(.[0-9]+)?$" class="amount">
+</td>
+<td colspan="1">
+<input name="line_4_currency" size="3" placeholder="€">
+</td>
+<td colspan="1">
+<input name="line_4_comment" size="40">
+</td>
+<td colspan="1">
+<button type="button">add new</button>
+<button type="button">delete</button>
+</td>
+</tr>
+</table>
+</EXPANDED>
 <div>Gap:</div>
 <textarea id="gap_lines" name="raw_lines" cols="100" rows="2" class="tainter"></textarea>
 </form>