1import pytest
2
3def funcion_coninputs():
4 in1 = input('introduce1')
5 print(in1)
6 in2 = input('introduce2')
7 print(in2)
8 in3 = input('introduce3')
9 print(in3)
10 return in1, in2, in3
11
12
13def geninputs():
14 inputs = ['aaa', 'bbb', 'ccc']
15 for in in inputs:
16 yield in_
17
18GEN = gen_inputs()
19
20def test_funcion_con_inputs_withmonkey(monkeypatch):
21 monkeypatch.setattr('builtins.input', lambda : next(GEN))
22 i1, i2, i3 = funcion_con_inputs()
23 assert i1 == 'aaa'
24 assert i2 == 'bbb'
25 assert i3 == 'ccc'