comment tester avec pytest
bonjours
je cherche une solution avec la bibliothèque pytest pour crée un module test_nom.py pour un module nom.py
un module qui permet de tester si une sous-chaîne existe dans une chaîne de caractère ou non. merci
module nom.py
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| def nom():
dnom=str
dnom=''
for i in range(1,10):
tnom=str
tnom= str(input("donner un nom"))
dnom+=tnom
snom=str(input("donner un nouveau nom"))
if snom in dnom:
return ("la sous-chaine ",snom,"existe dans la chaine",dnom)
else:
return (snom,"n'esxiste pas dans",dnom) |