diff --git a/src/configmypy/tests/test_argparse_config.py b/src/configmypy/tests/test_argparse_config.py index ce97d51..d614217 100644 --- a/src/configmypy/tests/test_argparse_config.py +++ b/src/configmypy/tests/test_argparse_config.py @@ -3,8 +3,8 @@ TEST_CONFIG_DICT = { - 'default': {'opt': {'optimizer': 'adam', 'lr': 0.1}, - 'data': {'dataset': 'ns', 'batch_size': 12}}, + 'default': {'opt': {'optimizer': 'adam', 'lr': 0.1, 'regularizer': True}, + 'data': {'dataset': 'ns', 'batch_size': 12, 'test_resolutions':[16,32]}}, 'test': {'opt': {'optimizer': 'SGD'}} } @@ -17,12 +17,21 @@ def test_ArgparseConfig(monkeypatch): config.data.batch_size = 24 assert config == args assert kwargs == {} - - monkeypatch.setattr("sys.argv", ['test', '--data.batch_size', '24', '--config_name', 'test']) + + # test ability to infer None and iterables + monkeypatch.setattr("sys.argv", ['test', '--data.batch_size', '24',\ + '--data.test_resolutions', '[8, None]', + '--opt.regularizer', 'False', + '--config_name', 'test']) config = Bunch(TEST_CONFIG_DICT['default']) parser = ArgparseConfig(infer_types=True, config_name=None) args, kwargs = parser.read_conf(config) config.data.batch_size = 24 + assert args.data.test_resolutions == [8, None] + assert not args.opt.regularizer #boolean False, not 'False' + + args.data.test_resolutions = [16,32] + args.opt.regularizer = True assert config == args assert kwargs == Bunch(dict(config_name='test')) diff --git a/src/configmypy/type_inference.py b/src/configmypy/type_inference.py index 9d0719a..7d6c5ed 100644 --- a/src/configmypy/type_inference.py +++ b/src/configmypy/type_inference.py @@ -114,7 +114,6 @@ def __call__(self, var): var: original variable (any type) """ - print(f"{self.orig_type=} {var=}") if self.orig_type == bool: return infer_boolean(var, self.strict) elif self.orig_type == float or self.orig_type == int: