def test_ParserFiller_extract_positional_args_default_is_not_NOTHING(): SC = attr.make_class( "SC", { "x": attr.ib(default=123, metadata={METADATA_ARGPARSER: { 'help': 'some help' }}, type=int) }) ret = ParserFiller.extract_positional_args(SC, attr.fields_dict(SC)) assert ret == ([], attr.fields_dict(SC))
def test_ParserFiller_extract_positional_args_happy_path(): SC = attr.make_class( "SC", { "x": attr.ib(metadata={ METADATA_ARGPARSER: { 'action': 'store_bool', 'help': 'some help' } }, type=int) }) ret = ParserFiller.extract_positional_args(SC, attr.fields_dict(SC)) assert ret == ([attr.fields(SC).x], {})
def test_ParserFiller_extract_positional_args_no_metadata_argparser(): SC = attr.make_class("SC", {"x": attr.ib(type=int, repr=False, init=False)}) ret = ParserFiller.extract_positional_args(SC, attr.fields_dict(SC)) assert ret == ([], attr.fields_dict(SC))