MCPcopy Create free account
hub / github.com/apple/axlearn / test_invoke_unknown

Method test_invoke_unknown

axlearn/cli/utils_test.py:148–172  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

146 self.assertIn("the following arguments are required: --child2", stderr.getvalue())
147
148 def test_invoke_unknown(self):
149 # Test invoking a command with an unknown flag.
150 args = _parse(
151 [
152 self.root_module,
153 "child1",
154 "grandchild1",
155 "command1",
156 "--required=test",
157 "--unknown",
158 ]
159 )
160 self.assertEqual(
161 args.argv,
162 [
163 self.root_module,
164 "--required=test",
165 "--unknown",
166 "--undefok=root,root_default,child1",
167 "--root_default=some_value",
168 ],
169 )
170 returncode, _, stderr = _run(args)
171 self.assertEqual(returncode, 1)
172 self.assertIn("Flags parsing error: Unknown command line flag 'unknown'", stderr)
173
174 def test_invoke_undefok(self):
175 # Test invoking a command with --child2, which has undefok=False.

Callers

nothing calls this directly

Calls 2

_parseFunction · 0.85
_runFunction · 0.70

Tested by

no test coverage detected