From 5db02f27e9d4ae7bce8466c02fff34c82f56f709 Mon Sep 17 00:00:00 2001
From: Marko Mecina <marko.mecina@univie.ac.at>
Date: Tue, 28 Jan 2025 14:41:16 +0100
Subject: [PATCH] fix formatting in python script generator

---
 Tst/json_to_barescript.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Tst/json_to_barescript.py b/Tst/json_to_barescript.py
index 063904b..c4db6a1 100755
--- a/Tst/json_to_barescript.py
+++ b/Tst/json_to_barescript.py
@@ -46,13 +46,13 @@ def run(jfile, outfile, reportfunc=False, specfile=None):
         script += 'report = cfl.TestReport(specfile, rep_version, mib_version, gui=True)\n\n'
 
     # init code
-    script += '# INIT CODE\n{}\n#! CCS.BREAKPOINT\n\n'.format(data['_custom_imports'])
+    script += '# INIT CODE\n{}\n#! CCS.BREAKPOINT\n\n'.format(data.get('_custom_imports'))
 
     script += '# PRECONDITIONS\n# {}\n#! CCS.BREAKPOINT\n\n'.format(replace_newline(data['_precon_descr']))
     # script += '{}\n\n\n'.format(data['_precon_code'].strip())  # Add the precondition code
 
     for step in data['sequences'][0]['steps']:
-        comment = '# COMMENT: {}\n'.format(step['_step_comment'].strip()) if step['_step_comment'] != '' else ''
+        comment = '# COMMENT: {}\n'.format(replace_newline(step['_step_comment'])) if step['_step_comment'] != '' else ''
         cmd_code = step['_command_code'].strip()
         cmd_code += '\n' if cmd_code else ''
 
@@ -68,9 +68,9 @@ def run(jfile, outfile, reportfunc=False, specfile=None):
               '# {}\n' \
               '{}' \
               '{}' \
-              '# VERIFICATION: {}\n{}{}\n#! CCS.BREAKPOINT\n\n'.format(step['_step_number'], step['_description'].strip(), exec_step,
+              '# VERIFICATION: {}\n{}{}\n#! CCS.BREAKPOINT\n\n'.format(step['_step_number'], replace_newline(step['_description']), exec_step,
                                                                       cmd_code,
-                                                                      step['_verification_description'].strip(),
+                                                                      replace_newline(step['_verification_description']),
                                                                       verif_step,
                                                                       # step['_verification_code'].strip(), # Add verification code
                                                                       comment)
-- 
GitLab