(runner)
| 103 | |
| 104 | |
| 105 | def test_file_args(runner): |
| 106 | @click.command() |
| 107 | @click.argument(class="st">"input", type=click.File(class="st">"rb")) |
| 108 | @click.argument(class="st">"output", type=click.File(class="st">"wb")) |
| 109 | def inout(input, output): |
| 110 | while True: |
| 111 | chunk = input.read(1024) |
| 112 | if not chunk: |
| 113 | break |
| 114 | output.write(chunk) |
| 115 | |
| 116 | with runner.isolated_filesystem(): |
| 117 | result = runner.invoke(inout, [class="st">"-", class="st">"hello.txt"], input=class="st">"Hey!") |
| 118 | assert result.output == class="st">"" |
| 119 | assert result.exit_code == 0 |
| 120 | with open(class="st">"hello.txt", class="st">"rb") as f: |
| 121 | assert f.read() == bclass="st">"Hey!" |
| 122 | |
| 123 | result = runner.invoke(inout, [class="st">"hello.txt", class="st">"-"]) |
| 124 | assert result.output == class="st">"Hey!" |
| 125 | assert result.exit_code == 0 |
| 126 | |
| 127 | |
| 128 | def test_path_allow_dash(runner): |
nothing calls this directly
no test coverage detected