MCPcopy
hub / github.com/pallets/click / test_prompts

Function test_prompts

tests/test_testing.py:114–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112
113
114def test_prompts():
115 @click.command()
116 @click.option("--foo", prompt=True)
117 def test(foo):
118 click.echo(f"foo={foo}")
119
120 runner = CliRunner()
121 result = runner.invoke(test, input="wau wau\n")
122 assert not result.exception
123 assert result.output == "Foo: wau wau\nfoo=wau wau\n"
124
125 @click.command()
126 @click.option("--foo", prompt=True, hide_input=True)
127 def test(foo):
128 click.echo(f"foo={foo}")
129
130 runner = CliRunner()
131 result = runner.invoke(test, input="wau wau\n")
132 assert not result.exception
133 assert result.output == "Foo: \nfoo=wau wau\n"
134
135
136def test_getchar():

Callers

nothing calls this directly

Calls 2

invokeMethod · 0.95
CliRunnerClass · 0.90

Tested by

no test coverage detected