def testCallable(self): with self.assertOutputMatches(stdout=r"foo:\s+foo\s+", stderr=None): core.Fire(tc.CallableWithKeywordArgument(), command=["--foo=foo"]) with self.assertOutputMatches(stdout=r"foo\s+", stderr=None): core.Fire(tc.CallableWithKeywordArgument(), command=["print_msg", "foo"]) with self.assertOutputMatches(stdout=r"", stderr=None): core.Fire(tc.CallableWithKeywordArgument(), command=[])
def testCallable(self): with self.assertOutputMatches(stdout=r'foo:\s+foo\s+', stderr=None): core.Fire(tc.CallableWithKeywordArgument(), command=['--foo=foo']) with self.assertOutputMatches(stdout=r'foo\s+', stderr=None): core.Fire(tc.CallableWithKeywordArgument(), command=['print_msg', 'foo']) with self.assertOutputMatches(stdout=r'', stderr=None): core.Fire(tc.CallableWithKeywordArgument(), command=[])
def testUsageOutputCallable(self): # This is both a group and a command. component = tc.CallableWithKeywordArgument() t = trace.FireTrace( component, name="CallableWithKeywordArgument", separator="@" ) usage_output = helptext.UsageText(component, trace=t, verbose=False) expected_output = """ Usage: CallableWithKeywordArgument <command> | <flags> available commands: print_msg flags are accepted For detailed information on this command, run: CallableWithKeywordArgument -- --help""" self.assertEqual(textwrap.dedent(expected_output).lstrip("\n"), usage_output)