From 0530696911351ef7ff02c488a2d23cf878c56f49 Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Mon, 11 Mar 2024 16:09:06 +0100
Subject: [PATCH] write produced code in temp file to help debug tests

---
 .gitignore           | 3 ++-
 tests/test_outils.py | 9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 598a38d..7c41c1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@ __pycache__
 .venv
 .idea
 dist/
-results*/
\ No newline at end of file
+results*/
+*.candidate.nf
\ No newline at end of file
diff --git a/tests/test_outils.py b/tests/test_outils.py
index 9fe2c7d..c0cb904 100644
--- a/tests/test_outils.py
+++ b/tests/test_outils.py
@@ -1,3 +1,4 @@
+import os
 import unittest
 from src.outils import *
 
@@ -36,6 +37,10 @@ class TestOutils(unittest.TestCase):
     
         with open("tests/ressources/outils/remove_comments_wo.nf", 'r') as f:
             code_wo_comments = f.read()
-        self.assertEqual(remove_comments(code_with_comments), code_wo_comments)
 
-    
+        produced = remove_comments(code_with_comments)
+        with open(candidate := "tests/ressources/outils/remove_comments_wo.candidate.nf", 'w') as f:
+            f.write(produced)
+
+        self.assertEqual(produced, code_wo_comments)
+        os.unlink(candidate)
-- 
GitLab