jeudi 25 juin 2020

How to test a function asking for user input in Python [duplicate]

I would like to test the following Python function using pytest:

def increase_by_one()
    n = int(input())
    return n + 1

How can I write to the stdin/user input request within a function, for testing purposes?

Aucun commentaire:

Enregistrer un commentaire