def test_capitals(): """ Test for words with capital letters """ assert pig_latinify("Aaron") == "aaronyay" assert pig_latinify("Toronto") == "orontotay" assert pig_latinify("pyThoN") == "onpythay"
def test_capitalize_word(): try: pig_latinify("Happy") except ValueError: assert True else: assert False
def test_multiple_word(): try: pig_latinify("apple happy") except ValueError: assert True else: assert False
def test_unexpected_word(): try: pig_latinify(3) except ValueError: assert True else: assert False
def test_integer(): """ This test case checks if integers are an acceptable input. """ assert pig_latinify( 1337) == "Error. Does not start with vowel or consonant." assert pig_latinify( -1337) == "Error. Does not start with vowel or consonant."
def test_basic(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay"
def test_advanced(): """ These test strings with a combination of capitals, numbers and symbols """ assert pig_latinify("hell0 W0R|D") == "ell0 w0r|dhay" assert pig_latinify("#hashtag") == "Error. Does not start with vowel or consonant." assert pig_latinify(" HELLO WORLD") == "Error. Does not start with vowel or consonant." assert pig_latinify("0987@#$%*&") == "Error. Does not start with vowel or consonant." assert pig_latinify("#Y O L O S W A G 360n0ScoPe") == "Error. Does not start with vowel or consonant."
def test_word_containing_alphanumeric(): """ Tests alphanumeric input """ for word in word_containing_alphanumeric: try: pig_latinify("HE90LLO") except TypeError: assert True
def test_advanced(): # Test in advanced steps assert pig_latinify("anxiety") == "anxietyyay" # Test a word with dash in it assert pig_latinify("sub-string") == "ub-stringsay" # Test a word with special character in it assert pig_latinify("high-five") == "igh-fivehay" # Test a very long word assert pig_latinify("supercalifragilisticexpialidocious") == "upercalifragilisticexpialidocioussay"
def test_additional(): """ Additional test cases we added ourselves, including variety of words and capitalization styles. """ assert pig_latinify("eggplant") == "eggplantyay" assert pig_latinify("Shelter") == "eltershay" assert pig_latinify("STROBE") == "obestray" assert pig_latinify("so") == "osay" assert pig_latinify("Grobarts") == "obartsgray"
def test_advanced(): """ More advanced test cases, with ys and spaces and cases """ assert pig_latinify('python') == 'ythonpay' assert pig_latinify('yooper') == 'ooperyay' assert pig_latinify('Youth') == 'outhyay' assert pig_latinify(' spacey ') == 'aceyspay' assert pig_latinify('supercallifragilisticexpialidocious' ) == 'upercallifragilisticexpialidocioussay'
def test_input_error(): try: pig_latinify(22) except AttributeError: assert True try: pig_latinify(dksad) except NameError: assert True
def test_advanced(): # Test in advanced steps assert pig_latinify("anxiety") == "anxietyyay" # Test a word with dash in it assert pig_latinify("sub-string") == "ub-stringsay" # Test a word with special character in it assert pig_latinify("high-five") == "igh-fivehay" # Test a very long word assert pig_latinify("supercalifragilisticexpialidocious" ) == "upercalifragilisticexpialidocioussay"
def test_advanced(): """ These test strings with a combination of capitals, numbers and symbols """ assert pig_latinify("hell0 W0R|D") == "ell0 w0r|dhay" assert pig_latinify( "#hashtag") == "Error. Does not start with vowel or consonant." assert pig_latinify( " HELLO WORLD") == "Error. Does not start with vowel or consonant." assert pig_latinify( "0987@#$%*&") == "Error. Does not start with vowel or consonant." assert pig_latinify("#Y O L O S W A G 360n0ScoPe" ) == "Error. Does not start with vowel or consonant."
def test_errors(): assert pig_latinify( 1234 ) == "Error! Please only enter characters between A-Z. Please enter a word:" assert pig_latinify( "Elly-May" ) == "Error! Please only enter characters between A-Z. Please enter a word:" assert pig_latinify( "Winston Churchill" ) == "Error! Please only enter characters between A-Z. Please enter a word:" assert pig_latinify( "Ke$ha" ) == "Error! Please only enter characters between A-Z. Please enter a word:"
def test_basic(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay" assert pig_latinify("oRaNgE") == "orangeyay" assert pig_latinify("Pumpkin") == "umpkinpay" assert pig_latinify("snowflake") == "owflakesnay" assert pig_latinify("123456") == "" assert pig_latinify("Pony123") == ""
def test_basic(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay" assert pig_latinify("9gag") == "Please only enter alphabetic characters, and please enter at least one." assert pig_latinify("") == "Please only enter alphabetic characters, and please enter at least one." assert pig_latinify("zznrrr") == "zznrrray" assert pig_latinify("ZLPRRR") == "zlprrray" assert pig_latinify("ZlRRp") == "zlrrpay"
def test_multiple_variables(): """ tests if multiple variables are accepted. """ try: assert pig_latinify("afds", "1234") except TypeError: return True
def test_pig_latinify(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay" # Testing words with uppercase assert pig_latinify("Almond") == "almondyay" assert pig_latinify("Phone") == "onephay" assert pig_latinify("wHaT") == "atwhay" assert pig_latinify("PHarmAcy") == "armacyphay" # Testing words with no vowel assert pig_latinify("why") == "whyay" assert pig_latinify("try") == "tryay"
def test_basic(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay" assert pig_latinify("ScaLLywag") == "allywagscay" assert pig_latinify("oodles") == "oodlesyay" assert pig_latinify("Barley") == "arleybay" assert pig_latinify("whisper") == "isperwhay"
def test_non_alphabetic(): """ Test non-alphabetic strings and non-string inputs """ non_alphabetic_words = ["sd12d", "a25d", ",.{}-", "2153", 2523, "get.it.done", True, 24.25, "two words"] for item in non_alphabetic_words: try: assert pig_latinify(item) assert False except ValueError: assert True
def test_alphabetic_no_vowel(): """ Test alphabetic strings without vowels """ alphabetic_words_without_vowels = ["hyd","jk","wrp","bcdfghjklmn"] for item in alphabetic_words_without_vowels: try: assert pig_latinify(item) assert False except ValueError: assert True
def test_bad_inputs(): """ Test cases for incorrect inputs """ try: pig_latinify('12345') except ValueError: assert True else: assert False try: pig_latinify('two words') == False except ValueError: assert True else: assert False try: pig_latinify('c0mb1n3d,w0rd') == False except ValueError: assert True else: assert False try: pig_latinify(12345) == False except ValueError: assert True else: assert False try: pig_latinify(["list", 1]) == False except ValueError: assert True else: assert False
def test_basic(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay" assert pig_latinify("python") == "ythonpay" assert pig_latinify("APPLE") == "appleyay" # when a word containing multiple vowels is passed in as a parameter assert pig_latinify("paramvir") == "aramvirpay"
def test_basic(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay" # Test case to check what is the result if we type integer and string . assert pig_latinify("34apple") == "Error: This input contains numbers or non-letter characters" # Test case to check what is the result if we type integers. assert pig_latinify(33434343) == "Error: This input contains numbers or non-letter characters"
def test_illegal(): """ checks that program returns ERROR if illegal input is encountered """ # when an integer is passed in as a parameter assert pig_latinify(123) == "ERROR" # when a string containing numbers is passed in as a parameter assert pig_latinify("123") == "ERROR" # when special characters are provided assert pig_latinify("!@#$%") == "ERROR" # when alphanumeric string is passed in as a parameter assert pig_latinify("as123f") == "ERROR" assert pig_latinify("y3llow") == "ERROR" # when an empty string is passed in as a parameter assert pig_latinify("") == "ERROR"
def test_words_no_vowels(): """ Test for words containing no vowels """ assert pig_latinify("cry") == "cryay" assert pig_latinify("sky") == "skyay"
def test_basic(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay" assert pig_latinify("beyonce") == "eyoncebay" assert pig_latinify("jayz") == "ayzjay" assert pig_latinify("carter") == "artercay" assert pig_latinify("lager") == "agerlay" assert pig_latinify("witbier") == "itbierway" assert pig_latinify("octopus") == "octopusyay" assert pig_latinify("41") == "" # This test case shows the result of an invalid input and should display nothing
def test_our_basic(): """ Basic test cases added. """ # word starts with a vowel assert pig_latinify("if") == "ifyay" assert pig_latinify("all") == "allyay" # vowel in middle assert pig_latinify("world") == "orldway" assert pig_latinify("not") == "otnay" # vowel at the end assert pig_latinify("who") == "owhay" assert pig_latinify("the") == "ethay" # has more than one vowel assert pig_latinify("where") == "erewhay" assert pig_latinify("because") == "ecausebay" # word with no vowel assert pig_latinify("why") == "whyay" assert pig_latinify("cry") == "cryay" # word with capitalization assert pig_latinify("World") == "orldWay" assert pig_latinify("Not") == "otNay" # word with hyphen/dot assert pig_latinify("sugar-free") == "ugar-freesay" assert pig_latinify("good-hearted") == "ood-heartedgay" assert pig_latinify("i.e.") == "i.e.yay"
def test_all_vowels(): # Test case for only vowels assert pig_latinify("aaa") == "aaayay" assert pig_latinify("eeee") == "eeeeyay"
def test_no_consonants(): # Test case for no vowels assert pig_latinify("why") == "whyay" assert pig_latinify("try") == "tryay" assert pig_latinify("hmmm") == "hmmmay"
def test_spaces(): """ This test case checks if spaces are an acceptable input. """ assert pig_latinify( " ") == "Error. Does not start with vowel or consonant."
def test_consonants_y(): # Test case with multiple consonants and y as a consonant assert pig_latinify("synchronize") == "onizesynchray" assert pig_latinify("psychology") == "ologypsychay"
def test_capitals(): """ This test case checks if capitals are an acceptable input. """ assert pig_latinify("HELLO WORLD") == "ello worldhay"
def test_advanced(): assert pig_latinify("BILLY") == "illybay" assert pig_latinify("asdfghhjkloiytffv") == "asdfghhjkloiytffvyay" assert pig_latinify("phlegm") == "egmphlay"
def test_basic(): assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay"
def test_advanced(): assert pig_latinify("bear") == "earbay" assert pig_latinify("porcupine") == "orcupinepay" assert pig_latinify("seal") == "ealsay" assert pig_latinify("boar") == "oarbay"
def test_single_letter(): """ Test words consisting of a single letter """ assert pig_latinify("a") == "ayay" assert pig_latinify("I") == "iyay"
def test_consonants(): # Test case starting with consonants assert pig_latinify("dday") == "aydday" assert pig_latinify("ssnakes") == "akesssnay"
def test_basic(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay" # test with multiple vowels in word assert pig_latinify("wonderful") == "onderfulway" # test with vowels in uppercase in word assert pig_latinify("Apple") == "Appleyay" # test with non-letters in string try: pig_latinify("2d") except ValueError: assert True # test with integer instead of string try: pig_latinify(34) except TypeError: assert True # test with empty string try: pig_latinify("") except ValueError: assert True
def test_basic(): """ Basic test cases from assignment hand out """ assert pig_latinify("dog") == "ogday" assert pig_latinify("scratch") == "atchscray" assert pig_latinify("is") == "isyay" assert pig_latinify("apple") == "appleyay" # one consonant assert pig_latinify("home") == "omehay" # two consonants assert pig_latinify("children") == "ildrenchay" # three consonants assert pig_latinify("screw") == "ewscray" # consonant uppercase assert pig_latinify("Car") == "arCay" # one vowel assert pig_latinify("apple") == "appleyay" assert pig_latinify("Aaron") == "Aaronyay" # numbers assert pig_latinify("123") == 'Only letters allowed!' # blank space assert pig_latinify(" ") == "Only letters allowed!"