本文整理汇总了Python中exercise1.pig_latinify函数的典型用法代码示例。如果您正苦于以下问题:Python pig_latinify函数的具体用法?Python pig_latinify怎么用?Python pig_latinify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pig_latinify函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_capitalize_word
def test_capitalize_word():
try:
pig_latinify("Happy")
except ValueError:
assert True
else:
assert False
开发者ID:owusuthe,项目名称:inf1340_2015_asst2,代码行数:7,代码来源:test_exercise1.py
示例2: test_multiple_word
def test_multiple_word():
try:
pig_latinify("apple happy")
except ValueError:
assert True
else:
assert False
开发者ID:owusuthe,项目名称:inf1340_2015_asst2,代码行数:7,代码来源:test_exercise1.py
示例3: test_capitals
def test_capitals():
"""
Test for words with capital letters
"""
assert pig_latinify("Aaron") == "aaronyay"
assert pig_latinify("Toronto") == "orontotay"
assert pig_latinify("pyThoN") == "onpythay"
开发者ID:aacampb,项目名称:inf1340_2015_asst2,代码行数:7,代码来源:test_exercise1.py
示例4: test_unexpected_word
def test_unexpected_word():
try:
pig_latinify(3)
except ValueError:
assert True
else:
assert False
开发者ID:owusuthe,项目名称:inf1340_2015_asst2,代码行数:7,代码来源:test_exercise1.py
示例5: test_basic
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"
开发者ID:piaoyaoshi,项目名称:inf1340_2015_asst2,代码行数:8,代码来源:test_exercise1.py
示例6: test_advanced
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("[email protected]#$%*&") == "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."
开发者ID:Momomelo,项目名称:inf1340_2015_asst2,代码行数:9,代码来源:test_exercise1.py
示例7: test_word_containing_alphanumeric
def test_word_containing_alphanumeric():
"""
Tests alphanumeric input
"""
for word in word_containing_alphanumeric:
try:
pig_latinify("HE90LLO")
except TypeError:
assert True
开发者ID:yueyueyang,项目名称:inf1340_2015_asst2,代码行数:9,代码来源:test_exercise1.py
示例8: test_additional
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"
开发者ID:bw8932,项目名称:inf1340_2015_asst2,代码行数:9,代码来源:test_exercise1.py
示例9: test_advanced
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"
开发者ID:xueshen3,项目名称:inf1340_2015_asst2,代码行数:9,代码来源:test_exercise1.py
示例10: test_advanced
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'
开发者ID:ideluce,项目名称:inf1340_2015_asst2,代码行数:10,代码来源:test_exercise1.py
示例11: test_input_error
def test_input_error():
try:
pig_latinify(22)
except AttributeError:
assert True
try:
pig_latinify(dksad)
except NameError:
assert True
开发者ID:peaceandiago,项目名称:inf1340_2015_asst2,代码行数:10,代码来源:test_exercise1.py
示例12: test_basic
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"
开发者ID:rawtoast24,项目名称:inf1340_2015_asst2,代码行数:13,代码来源:test_exercise1.py
示例13: test_basic
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") == ""
开发者ID:alyhashahrukh,项目名称:inf1340_2015_asst2,代码行数:13,代码来源:test_exercise1.py
示例14: test_multiple_variables
def test_multiple_variables():
"""
tests if multiple variables are accepted.
"""
try:
assert pig_latinify("afds", "1234")
except TypeError:
return True
开发者ID:Momomelo,项目名称:inf1340_2015_asst2,代码行数:8,代码来源:test_exercise1.py
示例15: test_pig_latinify
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"
开发者ID:peaceandiago,项目名称:inf1340_2015_asst2,代码行数:18,代码来源:test_exercise1.py
示例16: test_non_alphabetic
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
开发者ID:notoriousarg,项目名称:inf1340_2015_asst2,代码行数:11,代码来源:test_exercise1.py
示例17: test_alphabetic_no_vowel
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
开发者ID:notoriousarg,项目名称:inf1340_2015_asst2,代码行数:11,代码来源:test_exercise1.py
示例18: test_basic
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"
开发者ID:siuminglee,项目名称:inf1340_2015_asst2,代码行数:13,代码来源:test_exercise1.py
示例19: test_bad_inputs
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
开发者ID:ideluce,项目名称:inf1340_2015_asst2,代码行数:38,代码来源:test_exercise1.py
示例20: test_basic
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"
开发者ID:param411singh,项目名称:inf1340_2015_asst2,代码行数:13,代码来源:test_exercise1.py
注:本文中的exercise1.pig_latinify函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论