Skip to content

Commit b7443f8

Browse files
test input CSV for FPC5
1 parent bec47ed commit b7443f8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/test_geophires_x_client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import csv
4+
import json
45
import tempfile
56
import uuid
67
from 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

Comments
 (0)