I am trying to write test function for my print function. But there I got problem. Can you help me if I'm doing it in a right way? and what am I doing wrong? I am using capture stdout statement for my test.
def func(name):
print('')
print(' %s' % name)
print('You have finished your test.')
@pytest.mark.parametrize('name, expected_out',
[('', ''),
('something', 'something'),
('You have finished your test.', 'You have finished your test.')])
def test_func(capsys, name, expected_out):
func('name')# I don't sure that here I need to pass an argument
out, _ = capsys.readoutter()
assert out == expected_out
And I got this kind of error for all my lines.
Aucun commentaire:
Enregistrer un commentaire