11from __future__ import annotations
22
33import csv
4+ import json
45import tempfile
56import uuid
67from pathlib import Path
@@ -643,6 +644,15 @@ def test_stash_cwd(self):
643644
644645 self .assertEqual (start_cwd , Path .cwd ())
645646
647+ def _assert_fpc5_input_dict_csv (self , parse_units_and_comments : bool ):
648+ with open (self ._get_test_file_path ('fpc5-input-params-dict.json' ), encoding = 'utf-8' ) as f :
649+ fpc5_input_dict = json .loads (f .read ())
650+
651+ fpc_input_dict_as_csv = ImmutableGeophiresInputParameters (params = fpc5_input_dict ).as_csv (
652+ parse_units_and_comments = parse_units_and_comments
653+ )
654+ self .assertEqual (len (fpc5_input_dict .keys ()), len (fpc_input_dict_as_csv .splitlines ()))
655+
646656 def test_csv_with_input_parameters (self ):
647657 with self .assertRaises (NotImplementedError ):
648658 # This should fail because CSV from file path is not implemented.
@@ -670,6 +680,8 @@ def test_csv_with_input_parameters(self):
670680 with open (result_file , 'w' , newline = '' , encoding = 'utf-8' ) as rf :
671681 rf .write (csv_result )
672682
683+ self ._assert_fpc5_input_dict_csv (parse_units_and_comments = False )
684+
673685 def test_csv_with_input_parameters_parse_units_and_comments (self ):
674686 csv_input_with_units_and_comments = ImmutableGeophiresInputParameters (
675687 params = {
@@ -691,3 +703,5 @@ def test_csv_with_input_parameters_parse_units_and_comments(self):
691703 self .assertCsvFileContentsEqual (
692704 self ._get_test_file_path ('input-parameters-with-parsed-units-and-comments.csv' ), result_file
693705 )
706+
707+ self ._assert_fpc5_input_dict_csv (parse_units_and_comments = True )
0 commit comments