retronews

a featureful fork of the luke8086/retronews hn+lobste.rs tui
Log | Files | Refs | README | LICENSE

commit 70d53232f79973d00ac4f22edb3ae9952cbac401
parent 3b8dbb52dd4c6feacecfd100b6b86f0f1a3336de
Author: luke8086 <55237178+luke8086@users.noreply.github.com>
Date:   Tue,  2 Aug 2022 21:49:37 +0000

Additional test for code blocks

Diffstat:
Mtests.py | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/tests.py b/tests.py @@ -80,6 +80,24 @@ class TestHtmlParser(unittest.TestCase): ] self.assertLines(html, lines) + def test_long_code_blocks(self): + # Make sure long code doesn't get wrapped + html = ( + "<p>Lorem ipsum dolor sit amet, pro eu soleat civibus.</p>" + + "<p><pre><code> lambda L: [] if L==[] else qsort([x for x in L[1:] " + + "if x< L[0]]) + L[0:1] + qsort([x for x in L[1:] if x>=L[0]])\n</code></pre>\n" + + "Mel quas sensibus te. Noster nominati recteque no has.</p>" + ) + lines = [ + "Lorem ipsum dolor sit amet, pro eu soleat civibus.", + "", + " lambda L: [] if L==[] else qsort([x for x in L[1:] if x< L[0]]) + L[0:1] " + + "+ qsort([x for x in L[1:] if x>=L[0]])", + "", + "Mel quas sensibus te. Noster nominati recteque no has.", + ] + self.assertLines(html, lines) + def assertLines(self, html: str, lines: list[str]) -> None: self.assertListEqual(retronews.parse_html(html), lines)