MCPcopy Index your code
hub / github.com/python/cpython / assertParseFail

Method assertParseFail

Lib/test/test_optparse.py:139–149  ·  view source on GitHub ↗

Assert the parser fails with the expected message. Caller must ensure that self.parser is an InterceptingOptionParser.

(self, cmdline_args, expected_output)

Source from the content-addressed store, hash-verified

137 # -- Assertions used in more than one class --------------------
138
139 def assertParseFail(self, cmdline_args, expected_output):
140 """
141 Assert the parser fails with the expected message. Caller
142 must ensure that self.parser is an InterceptingOptionParser.
143 """
144 try:
145 self.parser.parse_args(cmdline_args)
146 except InterceptedError as err:
147 self.assertEqual(err.error_message, expected_output)
148 else:
149 self.assertFalse("expected parse failure")
150
151 def assertOutput(self,
152 cmdline_args,

Calls 3

assertFalseMethod · 0.80
parse_argsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected