diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2017-12-13 14:41:46 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2017-12-13 14:41:46 +1300 |
commit | e63bb8cde5a62c7b0ad0b6e6577e8e1a78e822f5 (patch) | |
tree | bf666a2bca96edadefad727b2bdc4bcc551c1c2d /test | |
parent | 4cee1a4f96ef7307e422cf227c8389563323e442 (diff) | |
download | mitmproxy-e63bb8cde5a62c7b0ad0b6e6577e8e1a78e822f5.tar.gz mitmproxy-e63bb8cde5a62c7b0ad0b6e6577e8e1a78e822f5.tar.bz2 mitmproxy-e63bb8cde5a62c7b0ad0b6e6577e8e1a78e822f5.zip |
commands: add a Path argument type
This is just an alias for str, and in this patch is used mostly to give an
appropriate type in help strings. More to come.
Fixes #2198
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_command.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py index cb9dc4ed..abb09cea 100644 --- a/test/mitmproxy/test_command.py +++ b/test/mitmproxy/test_command.py @@ -35,6 +35,9 @@ class TAddon: def choose(self, arg: TChoice) -> typing.Sequence[str]: # type: ignore return ["one", "two", "three"] + def path(self, arg: command.Path) -> None: + pass + class TestCommand: def test_varargs(self): @@ -97,6 +100,7 @@ def test_typename(): assert command.typename(typing.Sequence[str], False) == "[str]" assert command.typename(TChoice, False) == "choice" + assert command.typename(command.Path, False) == "path" class DummyConsole: @@ -156,6 +160,10 @@ def test_parsearg(): tctx.master.commands, "invalid", TChoice, ) + assert command.parsearg( + tctx.master.commands, "foo", command.Path + ) == "foo" + class TDec: @command.command("cmd1") |