From f2b0bf42c6005a0da313c77fa5fc0f951c5f308b Mon Sep 17 00:00:00 2001 From: Carsten Grohmann Date: Thu, 16 Mar 2023 23:00:36 +0100 Subject: [PATCH] Add a non-breaking space between number and unit --- OOMAnalyser.py | 16 ++++++++-------- test.py | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/OOMAnalyser.py b/OOMAnalyser.py index f725270..588f439 100644 --- a/OOMAnalyser.py +++ b/OOMAnalyser.py @@ -4178,26 +4178,26 @@ Out of memory: Killed process 651 (unattended-upgr) total-vm:108020kB, anon-rss: if item.endswith("_pages") and isinstance(content, int): if content == 1: - content = "{} page".format(content) + content = "{} page".format(content) else: - content = "{} pages".format(content) + content = "{} pages".format(content) if item.endswith("_bytes") and isinstance(content, int): if content == 1: - content = "{} Byte".format(content) + content = "{} Byte".format(content) else: - content = "{} Bytes".format(content) + content = "{} Bytes".format(content) if item.endswith("_kb") and isinstance(content, int): if content == 1: - content = "{} kByte".format(content) + content = "{} kByte".format(content) else: - content = "{} kBytes".format(content) + content = "{} kBytes".format(content) if item.endswith("_percent") and isinstance(content, int): - content = "{}%".format(content) + content = "{} %".format(content) - element.textContent = content + element.innerHTML = content if DEBUG: show_element("notify_box") diff --git a/test.py b/test.py index a6a46c5..038e2d6 100755 --- a/test.py +++ b/test.py @@ -237,12 +237,13 @@ class TestInBrowser(TestBase): "Total memory in summary not found", ) self.assertTrue( - "94% (31705788 kBytes out of 33519336 kBytes) physical memory" + "94 % (31705788 kBytes out of 33519336 kBytes) physical memory" in explanation.text, "Used physical memory in summary not found", ) self.assertTrue( - "99% (8343236 kBytes out of 8388604 kBytes) swap space" in explanation.text, + "99 % (8343236 kBytes out of 8388604 kBytes) swap space" + in explanation.text, "Used swap space in summary not found", ) self.assertTrue( @@ -320,7 +321,7 @@ class TestInBrowser(TestBase): "Physical and swap memory in summary not found", ) self.assertTrue( - "9% (209520 kBytes out of 2096632 kBytes) physical memory" + "9 % (209520 kBytes out of 2096632 kBytes) physical memory" in explanation.text, "Used physical memory in summary not found", )