From 02ea98d597fd9787731cebe862eb6fed2a578a7f Mon Sep 17 00:00:00 2001 From: gtema Date: Thu, 27 Oct 2022 12:47:12 +0000 Subject: [PATCH] Improve comparison Reviewed-by: Goncharov, Artem Co-authored-by: gtema Co-committed-by: gtema --- otc_doc_convertor/comparator.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/otc_doc_convertor/comparator.py b/otc_doc_convertor/comparator.py index 1397250dc..4643dcaa7 100644 --- a/otc_doc_convertor/comparator.py +++ b/otc_doc_convertor/comparator.py @@ -35,9 +35,15 @@ class OTCComparator: t1 = original.find(body_filter) t2 = new.find(body_filter) if t1 != t2: - logging.error("Content mismatch") - return False - logging.info("Content matches") + if t1.get_text() != t2.get_text(): + logging.error( + "File %s is not matching, but " + "plain text matches" % file_name) + return False + else: + logging.error("File %s mismatches" % file_name) + else: + logging.info("Content matches") return True except Exception as ex: logging.error("Content comparison error %s" % ex)