mirror of
https://github.com/borgbackup/borg.git
synced 2026-05-23 10:36:32 -04:00
tests: make FakeInput usage less suspicious for code checkers
This commit is contained in:
parent
2a9429d9d7
commit
79ffb3fcde
2 changed files with 7 additions and 4 deletions
|
|
@ -432,6 +432,9 @@ class FakeInputs:
|
|||
def __init__(self, inputs):
|
||||
self.inputs = inputs
|
||||
|
||||
def available(self):
|
||||
return bool(self.inputs)
|
||||
|
||||
def __call__(self, prompt=None):
|
||||
if prompt is not None:
|
||||
print(prompt, end='')
|
||||
|
|
|
|||
|
|
@ -796,21 +796,21 @@ class TestBuffer:
|
|||
def test_yes_input():
|
||||
inputs = list(TRUISH)
|
||||
input = FakeInputs(inputs)
|
||||
for i in inputs:
|
||||
while input.available():
|
||||
assert yes(input=input)
|
||||
inputs = list(FALSISH)
|
||||
input = FakeInputs(inputs)
|
||||
for i in inputs:
|
||||
while input.available():
|
||||
assert not yes(input=input)
|
||||
|
||||
|
||||
def test_yes_input_defaults():
|
||||
inputs = list(DEFAULTISH)
|
||||
input = FakeInputs(inputs)
|
||||
for i in inputs:
|
||||
while input.available():
|
||||
assert yes(default=True, input=input)
|
||||
input = FakeInputs(inputs)
|
||||
for i in inputs:
|
||||
while input.available():
|
||||
assert not yes(default=False, input=input)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue