MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_argument

Method test_argument

testing/test_parseopt.py:31–47  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

29 assert parser._getparser().prog == "custom-prog"
30
31 def test_argument(self) -> None:
32 with pytest.raises(parseopt.ArgumentError):
33 # need a short or long option
34 argument = parseopt.Argument()
35 argument = parseopt.Argument("-t")
36 assert argument._short_opts == ["-t"]
37 assert argument._long_opts == []
38 assert argument.dest == "t"
39 argument = parseopt.Argument("-t", "--test")
40 assert argument._short_opts == ["-t"]
41 assert argument._long_opts == ["--test"]
42 assert argument.dest == "test"
43 argument = parseopt.Argument("-t", "--test", dest="abc")
44 assert argument.dest == "abc"
45 assert str(argument) == (
46 "Argument(_short_opts: ['-t'], _long_opts: ['--test'], dest: 'abc')"
47 )
48
49 def test_argument_type(self) -> None:
50 argument = parseopt.Argument("-t", dest="abc", type=int)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected