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

Method test_invalid_name

Lib/test/test_argparse.py:821–826  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

819 self.assertIn("got an unexpected keyword argument 'const'", str(cm.exception))
820
821 def test_invalid_name(self):
822 parser = argparse.ArgumentParser()
823 with self.assertRaises(ValueError) as cm:
824 parser.add_argument('--no-foo', action=argparse.BooleanOptionalAction)
825 self.assertEqual(str(cm.exception),
826 "invalid option name '--no-foo' for BooleanOptionalAction")
827
828class TestBooleanOptionalActionSingleDash(ParserTestCase):
829 """Tests BooleanOptionalAction with single dash"""

Callers

nothing calls this directly

Calls 4

strFunction · 0.85
assertRaisesMethod · 0.45
add_argumentMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected