From decb1a2cb534985954649b9a7a834aa6b92906b6 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Thu, 19 May 2022 15:25:40 +0200
Subject: [PATCH] relax dump config tests

---
 bob/extension/test_click_helper.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/bob/extension/test_click_helper.py b/bob/extension/test_click_helper.py
index 2cf8925..7a40549 100644
--- a/bob/extension/test_click_helper.py
+++ b/bob/extension/test_click_helper.py
@@ -191,11 +191,15 @@ def _assert_config_dump(ref, ref_date):
     # open(ref, 'wt').write(open('TEST_CONF').read())
     with open("TEST_CONF", "r") as f, open(ref, "r") as f2:
         text = f.read()
-        ref_text = f2.read().replace(ref_date, today)
-        # remove the starting whitespace of each line so the tests are more relaxed
-        text = "\n".join(line.lstrip() for line in text.splitlines())
-        ref_text = "\n".join(line.lstrip() for line in ref_text.splitlines())
-        assert text == ref_text
+        ref_text = f2.read()
+    ref_text = ref_text.replace(ref_date, today)
+    # remove the starting and final whitespace of each line so the tests are more relaxed
+    text = "\n".join(line.strip() for line in text.splitlines())
+    ref_text = "\n".join(line.strip() for line in ref_text.splitlines())
+    # replace ''' with """ so tests are more relaxed
+    text = text.replace("'''", '"""')
+    ref_text = ref_text.replace("'''", '"""')
+    assert text == ref_text
 
 
 def test_config_dump():
-- 
GitLab