本文整理汇总了Python中test_helper.run_common_tests函数的典型用法代码示例。如果您正苦于以下问题:Python run_common_tests函数的具体用法?Python run_common_tests怎么用?Python run_common_tests使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_common_tests函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_answer_placeholders
from test_helper import run_common_tests, failed, passed, get_answer_placeholders
def test_answer_placeholders():
placeholders = get_answer_placeholders()
if placeholders[0] != "__new__": # TODO: your condition here
failed("Error! method for creation instance is wrong!")
if placeholders[1] != "hasattr": # TODO: your condition here
failed("Error! func for checking is wrong!")
if placeholders[2] != "super": # TODO: your condition here
failed("Error! func for getting parents obj is wrong!")
if placeholders[3] != "__init__": # TODO: your condition here
failed("Error! method for initializing is wrong!")
if placeholders[4] != "id" or placeholders[5] != "id": # TODO: your condition here
failed("Error! func for getting is wrong!")
if placeholders[0] == "__new__" and placeholders[1] == "hasattr" and\
placeholders[2] == "super" and placeholders[3] == "__init__" and placeholders[4] == placeholders[5] == "id":
passed("Congratulations!!! Now you know how to create singleton!")
if __name__ == '__main__':
run_common_tests()
test_answer_placeholders() # TODO: uncomment test call
开发者ID:alexander121212,项目名称:learning-oop-in-pycharm,代码行数:24,代码来源:tests.py
示例2: test_value
from test_helper import run_common_tests, passed, failed, import_task_file, get_answer_placeholders
def test_value():
file = import_task_file()
if file.is_greater:
passed()
else:
failed("Use > operator")
def test_window():
window = get_answer_placeholders()[0]
if ">" in window and ">=" not in window:
passed()
else:
failed("Use > operator")
if __name__ == '__main__':
run_common_tests("You should modify the file")
test_value()
test_window()
开发者ID:JLGarber,项目名称:pycharm-courses,代码行数:22,代码来源:tests.py
示例3: test_window
from test_helper import run_common_tests, failed, passed, get_answer_placeholders
def test_window():
window = get_answer_placeholders()[0]
if " and " in window and " or " in window and " not " in window:
passed()
else:
failed("Use 'and', 'or' and 'not' keywords")
if __name__ == '__main__':
run_common_tests("Use 'and', 'or' and 'not' keywords")
test_window()
开发者ID:JLGarber,项目名称:pycharm-courses,代码行数:14,代码来源:tests.py
示例4: test_division
from test_helper import run_common_tests, passed, failed, import_task_file, get_answer_placeholders
def test_division():
file = import_task_file()
if file.division == 4.5:
passed()
else:
failed("Use / operator")
def test_remainder():
file = import_task_file()
if file.remainder == 1.0:
passed()
else:
failed("Use % operator")
def test_windows():
windows = get_answer_placeholders()
if "number" in windows[0] and "number" in windows[1]:
passed()
else:
failed("Use % operator")
if __name__ == '__main__':
run_common_tests("Use / and % operators")
test_division()
test_remainder()
开发者ID:JLGarber,项目名称:pycharm-courses,代码行数:31,代码来源:tests.py
示例5: test_window1
def test_window1():
window = get_task_windows()[0]
if "John" in window and "==" in window and "if " in window:
passed()
else:
failed("Use if keyword")
def test_window2():
window = get_task_windows()[1]
if "else" in window:
passed()
else:
failed("Use else keyword")
def test_columns():
windows = get_task_windows()
if ":" in windows[0] and ":" in windows[1]:
passed()
else:
failed("Don't forget about column at the end")
if __name__ == '__main__':
run_common_tests("Use if/else keywords")
test_window1()
test_window2()
test_columns()
开发者ID:cscenter,项目名称:EDIDE,代码行数:28,代码来源:tests.py
示例6: test_ASCII
def test_ASCII():
windows = get_answer_placeholders()
for window in windows:
all_ascii = all(ord(c) < 128 for c in window)
if not all_ascii:
failed("Please use only English characters this time.")
return
passed()
def test_is_alpha():
window = get_answer_placeholders()[0]
is_multiline = window.find("\n")
if is_multiline != -1:
window = window[:is_multiline-1]
splitted = window.split()
for s in splitted:
if not s.isalpha():
failed("Please use only English characters this time.")
return
passed()
if __name__ == '__main__':
test_ASCII()
run_common_tests("You should enter your name")
test_is_alpha()
开发者ID:JetBrains,项目名称:pycharm-courses,代码行数:28,代码来源:tests.py
示例7: test_ASCII
from test_helper import run_common_tests, failed, passed, get_task_windows
def test_ASCII():
windows = get_task_windows()
for window in windows:
all_ascii = all(ord(c) < 128 for c in window)
if not all_ascii:
failed("Please, use only english characters for this time.")
return
passed()
def test_is_alpha():
window = get_task_windows()[0]
splitted = window.split()
for s in splitted:
if not s.isalpha():
failed("Please, use only english characters for this time.")
return
passed()
if __name__ == '__main__':
test_ASCII()
run_common_tests("You should type your name")
test_is_alpha()
开发者ID:dot-Sean,项目名称:pycharm-courses,代码行数:27,代码来源:tests.py
示例8: test_value
from test_helper import run_common_tests, failed, passed, import_task_file, get_answer_placeholders
def test_value():
file = import_task_file()
if hasattr(file, "animals") and not file.animals:
passed()
else:
failed("Clear animals list")
def test_window():
window = get_answer_placeholders()[0]
if "animals" in window:
passed()
else:
failed("Clear animals list")
if __name__ == '__main__':
run_common_tests("Use assignment to empty list")
test_window()
test_value()
开发者ID:JetBrains,项目名称:pycharm-courses,代码行数:21,代码来源:tests.py
示例9: test_value
from test_helper import run_common_tests, failed, passed, import_task_file
def test_value():
file = import_task_file()
if file.greetings == "greetings":
failed("You should assign different value to the variable")
else:
passed()
if __name__ == '__main__':
test_value()
run_common_tests("You should redefine variable 'greetings'")
开发者ID:cscenter,项目名称:EDIDE,代码行数:14,代码来源:tests.py
示例10: test_window
from test_helper import run_common_tests, passed, failed, get_task_windows
def test_window():
window = get_task_windows()[0]
if "name" in window and "John" in window and "and" in window and "23" in window:
passed()
else:
failed("Use and keyword and != operator")
if __name__ == '__main__':
run_common_tests("Use 'and' keyword and != operator")
test_window()
开发者ID:dot-Sean,项目名称:pycharm-courses,代码行数:14,代码来源:tests.py
示例11: test_window
from test_helper import run_common_tests, failed, passed, get_task_windows
def test_window():
window = get_task_windows()[0]
if "grocery_dict" in window and " in " in window and "fish" in window:
passed()
else:
failed("Use in keyword")
if __name__ == '__main__':
run_common_tests("Use in keyword")
test_window()
开发者ID:cscenter,项目名称:EDIDE,代码行数:13,代码来源:tests.py
示例12: test_value
from test_helper import run_common_tests, import_task_file, passed, failed, get_answer_placeholders
def test_value():
file = import_task_file()
if "dinosaur" in file.animals and not "dino" in file.animals:
passed()
else:
failed("Replace 'dino' with 'dinosaur'")
def test_window():
window = get_answer_placeholders()[0]
if "animals" in window and "[" in window:
passed()
else:
failed("Replace 'dino' with 'dinosaur'")
if __name__ == '__main__':
run_common_tests("Use indexing and assignment")
test_value()
test_window()
开发者ID:JLGarber,项目名称:pycharm-courses,代码行数:21,代码来源:tests.py
示例13: test_value
from test_helper import run_common_tests, get_task_windows, passed, failed, get_file_output
def test_value():
output = get_file_output()
if "[4, 9, 16]" in output:
passed()
else:
failed("Use list slicing lst[index1:index2]")
def test_window():
window = get_task_windows()[0]
if "squares" in window and "[" in window and "]" in window and ":" in window:
passed()
else:
failed("Use list slicing lst[index1:index2]")
if __name__ == '__main__':
test_value()
test_window()
run_common_tests("Use list slicing lst[index1:index2]")
开发者ID:dot-Sean,项目名称:pycharm-courses,代码行数:21,代码来源:tests.py
示例14: run_common_tests
from test_helper import run_common_tests
if __name__ == '__main__':
run_common_tests("You should type new comment")
开发者ID:JLGarber,项目名称:pycharm-courses,代码行数:4,代码来源:tests.py
注:本文中的test_helper.run_common_tests函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论