I am writing a function that can turn any input into pig latin. It is assumed that the input will be passed into the function so user input is necessary at this time. I am trying to figure out my test cases for this but am only receiving this input:
Process finished with exit code 0
Can anyone explain why that is? I've outlined my code for both the function and test functions below:
Function
def pig_latinify(word):
"""
takes input from user
check IF there is a vowel at beginning
do this
ELSE
do this
print result
:param :
:return:
:raises:
"""
if word.isalpha() == False:
return AssertionError
elif word[0] in ("a", "e", "i", "o", "u"):
result = word + "yay"
else:
while word[0] not in ("a", "e", "i", "o", "u"):
word = word[1:] + word[0]
result = word + "ay"
print(result)
#pig_latinify()
Test Code
import pytest
import mock
from exercise1 import pig_latinify
word_starting_with_vowel = "apple"
word_starting_with_consonant = "scratch"
word_containing_alphanumeric = "HE90LLO"
def test_word_starting_with_vowel():
for item in word_starting_with_vowel:
assert pig_latinify("apple") == "appleyay"
def test_word_starting_with_vowel_2():
for item in word_starting_with_vowel:
assert pig_latinify("is") == "isyay"
def test_word_starting_with_consonant():
for item in word_starting_with_consonant:
assert pig_latinify("scratch") == "atchscray"
def test_word_containing_alphanumeric():
for item in word_containing_alphanumeric:
try:
pig_latinify("HE90LLO")
except AssertionError:
assert True