Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set SUPPRESS as the default value for add_subclass_arguments #90

Merged
merged 2 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jsonargparse/signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import inspect
import re
from argparse import Namespace
from argparse import Namespace, SUPPRESS
from functools import wraps
from typing import Any, Callable, List, Optional, Set, Tuple, Type, Union

Expand Down Expand Up @@ -491,7 +491,7 @@ def add_subclass_arguments(
{},
added_args,
skip,
default={},
default=SUPPRESS,
sub_configs=True,
instantiate=instantiate,
**kwargs
Expand Down
4 changes: 3 additions & 1 deletion jsonargparse_tests/signatures_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ def test_not_required_group(self):
parser = ArgumentParser(parse_as_dict=True, error_handler=None)
parser.add_subclass_arguments(calendar.Calendar, 'cal', required=False)
cfg = parser.parse_args([])
self.assertEqual(cfg, {'cal': {}})
self.assertEqual(cfg, {})
cfg_init = parser.instantiate_classes(cfg)
self.assertEqual(cfg_init, {})


def test_invalid_type(self):
Expand Down