From 23543de0cfe10abe6ec11dcdaf24a52236fe32f8 Mon Sep 17 00:00:00 2001 From: gtema Date: Wed, 2 Nov 2022 10:52:57 +0000 Subject: [PATCH] Ignore spaces in plain text comparison Reviewed-by: Goncharov, Artem Co-authored-by: gtema Co-committed-by: gtema --- otc_doc_convertor/comparator.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/otc_doc_convertor/comparator.py b/otc_doc_convertor/comparator.py index 6369489e..69014754 100644 --- a/otc_doc_convertor/comparator.py +++ b/otc_doc_convertor/comparator.py @@ -13,6 +13,10 @@ def body_filter(tag): ) +def simplify_body(data): + return data.get_text().replace(" ", "") + + class OTCComparator: def compare(self, url_prefix, file_path, file_name): @@ -35,7 +39,7 @@ class OTCComparator: t1 = original.find(body_filter) t2 = new.find(body_filter) if t1 != t2: - if t1.get_text() == t2.get_text(): + if simplify_body(t1) == simplify_body(t2): logging.error( "File %s is not matching, but " "plain text matches" % file_name)