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

Function test_getchar

tests/test_testing.py:136–163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134
135
136def test_getchar():
137 @click.command()
138 def continue_it():
139 click.echo(click.getchar())
140
141 runner = CliRunner()
142 result = runner.invoke(continue_it, input="y")
143 assert not result.exception
144 assert result.output == "y\n"
145
146 runner = CliRunner(echo_stdin=True)
147 result = runner.invoke(continue_it, input="y")
148 assert not result.exception
149 assert result.output == "y\n"
150
151 @click.command()
152 def getchar_echo():
153 click.echo(click.getchar(echo=True))
154
155 runner = CliRunner()
156 result = runner.invoke(getchar_echo, input="y")
157 assert not result.exception
158 assert result.output == "yy\n"
159
160 runner = CliRunner(echo_stdin=True)
161 result = runner.invoke(getchar_echo, input="y")
162 assert not result.exception
163 assert result.output == "yy\n"
164
165
166def test_catch_exceptions():

Callers

nothing calls this directly

Calls 2

invokeMethod · 0.95
CliRunnerClass · 0.90

Tested by

no test coverage detected