def test_default_subcmd_usage(self) -> None: root = EntryPoint(name="a") root.regist_sub(EntryPoint, name="b", schema={ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "a": { "type": "integer", "default": 1 } }, "required": ["a"] }, main=lambda **kwargs: None) root(["b"]) assert root.usage == "a [subcmd]"
def test_subcmd(self) -> None: root = EntryPoint(name="a") a_b_c = root.regist_sub(EntryPoint, name="b").regist_sub( EntryPoint, name="c", schema={ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "a": { "type": "integer" } }, "required": ["a"] }, main=lambda a: None) os.environ['A_B_C_A'] = "2" root(["b", "c"]) self.assertDictEqual(a_b_c.config, {"a": 2})