Skip to content

Commit 37a568c

Browse files
committed
Fix YAML input for top_traj_file:
- top_traj_file had a default value which meant it overided the merging of YAML and CLI - Removed the default value - Fixed tests to account for this change
1 parent 0e76f34 commit 37a568c

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

CodeEntropy/main_mcc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"type": str,
2020
"nargs": "+",
2121
"help": "Path to Structure/topology file followed by Trajectory file(s)",
22-
"default": [],
2322
},
2423
"selection_string": {
2524
"type": str,

tests/test_EntropyFunctions/test_main_mcc.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
import unittest
33
from unittest.mock import MagicMock, mock_open, patch
44

5-
from CodeEntropy.main_mcc import (
6-
arg_map,
7-
load_config,
8-
main,
9-
merge_configs,
10-
setup_argparse,
11-
)
5+
from CodeEntropy.main_mcc import load_config, main, merge_configs, setup_argparse
126

137

148
class test_maincc(unittest.TestCase):
@@ -208,12 +202,13 @@ def test_default_values(self, mock_parse_args):
208202
"""
209203
Test if argument parser assigns default values correctly.
210204
"""
211-
default_args = {arg: params["default"] for arg, params in arg_map.items()}
212-
mock_parse_args.return_value = MagicMock(**default_args)
205+
# Since there are no default values, we don't need to set them in the mock
206+
mock_parse_args.return_value = MagicMock(
207+
top_traj_file=["example.top", "example.traj"]
208+
)
213209
parser = setup_argparse()
214210
args = parser.parse_args()
215-
for arg, params in arg_map.items():
216-
self.assertEqual(getattr(args, arg), params["default"])
211+
self.assertEqual(args.top_traj_file, ["example.top", "example.traj"])
217212

218213
@patch(
219214
"argparse.ArgumentParser.parse_args", return_value=MagicMock(top_traj_file=None)

0 commit comments

Comments
 (0)