From c5a60176a917ca8ae4b3869e1f7db59d45921690 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 27 Apr 2024 17:28:33 +0100 Subject: [PATCH] Stricter check for inverted text --- tests.py | 7 +++++++ utils.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests.py b/tests.py index cd0a3dfbc..626772275 100644 --- a/tests.py +++ b/tests.py @@ -8679,6 +8679,13 @@ def _test_uninvert2(): print('uninverted: ' + uninverted_text) assert uninverted_text == 'This is a test.' + inverted_text = 'uspol' + uninverted_text = uninvert_text(inverted_text) + if uninverted_text != 'uspol': + print('inverted: ' + inverted_text) + print('uninverted: ' + uninverted_text) + assert uninverted_text == 'uspol' + def _test_check_individual_post_content(): print('check_individual_post_content') diff --git a/utils.py b/utils.py index 74498a797..f21265934 100644 --- a/utils.py +++ b/utils.py @@ -225,7 +225,7 @@ def uninvert_text(text: str) -> str: possible_result = ch_result + possible_result result = text - if matches > len(text)/3: + if matches > len(text)/2: result = possible_result new_result = '' extra_replace = {