本文整理汇总了Python中survey.AnonymousSurvey类的典型用法代码示例。如果您正苦于以下问题:Python AnonymousSurvey类的具体用法?Python AnonymousSurvey怎么用?Python AnonymousSurvey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AnonymousSurvey类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: TestAnonymousSurvey
class TestAnonymousSurvey(unittest.TestCase):
"""Testy dla klasy AnonymousSurvey."""
def setUp(self):
"""
Utworzenie ankiety i zestawu odpowiedzi do użycia
we wszystkich metodach testowych.
"""
question = "Jaki jest Twój ojczysty język?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['angielski', 'hiszpański', 'polski']
def test_store_single_response(self):
"""
Sprawdzenie, czy pojedyncza odpowiedź jest prawidłowo przechowywana.
"""
self.my_survey.store_response(self.responses[0])
self.assertIn(self.responses[0], self.my_survey.responses)
def test_store_three_responses(self):
"""
Sprawdzenie, czy trzy pojedyncze odpowiedzi są prawidłowo przechowywane.
"""
for response in self.responses:
self.my_survey.store_response(response)
for response in self.responses:
self.assertIn(response, self.my_survey.responses)
开发者ID:gorczynski,项目名称:python-crash-course,代码行数:29,代码来源:test_survey.py
示例2: TestAnonymousSurvey
class TestAnonymousSurvey(unittest.TestCase):
"""Tests for the class AnonymousSurvey"""
def setUp(self):
"""
Create a survey and a set of responses for use in all test methods.
"""
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ["English", "Spanish", "Mandarin"]
def test_store_single_response(self):
"""Test that a single response is stored properly."""
self.my_survey.store_response(self.responses[0])
self.assertIn(self.responses[0], self.my_survey.responses)
def test_store_three_responses(self):
"""Test that three individual responses are stored properly."""
for response in self.responses:
self.my_survey.store_response(response)
for response in self.responses:
self.assertIn(response, self.my_survey.responses)
开发者ID:crystalDf,项目名称:Python-Crash-Course-Chapter-11-Testing,代码行数:26,代码来源:test_survey.py
示例3: test_store_single_response
def test_store_single_response(self):
""" Testa se uma única resposta é armazenada de forma apropriada."""
question = "What language did you first learn to speak?"
my_survey = AnonymousSurvey(question)
my_survey.store_response('English')
self.assertIn('English',my_survey.responses)
开发者ID:weltonvaz,项目名称:Matthes,代码行数:7,代码来源:test_survey.py
示例4: test_store_single_response
def test_store_single_response(self):
"""test that a single response is store properly"""
question = "What language did you first learn to speak?"
my_survey = AnonymousSurvey(question) # create instance of class
my_survey.store_response('English')
self.assertIn('English', my_survey.responses)
开发者ID:monicamow,项目名称:pythoncrashcourse,代码行数:7,代码来源:test_survey.py
示例5: TestAnonymousSurvey
class TestAnonymousSurvey(unittest.TestCase):
# def test_store_single_response(self):
# # test that a single response is stored properly
# question = "What language did you first learn to speak?"
# my_survey = AnonymousSurvey(question)
# my_survey.store_response('English')
#
# self.assertIn('English', my_survey.responses)
#
# def test_store_three_responses(self):
# question = "What language did you first learn to speak?"
# my_survey = AnonymousSurvey(question)
# responses = ['English', 'Spanish', 'Portuguese']
# for response in responses:
# my_survey.store_response(response)
#
# for response in responses:
# self.assertIn(response, my_survey.responses)
#
# unittest.main()
def setUp(self):
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Spanish', 'Mandarin']
def test_store_single_response(self):
self.my_survey.store_response(self.responses[0])
self.assertIn(self.responses[0], self.my_survey.responses)
def test_store_three_responses(self):
for response in self.responses:
self.my_survey.store_response(response)
for response in self.responses:
self.assertIn(response, self.my_survey.responses)
开发者ID:bwynn,项目名称:python_cc,代码行数:35,代码来源:test_survey.py
示例6: test_store_single_response
def test_store_single_response(self):
"""Test that a single response is stores properly."""
question = "What language dig you first learn to speak?"
my_survey = AnonymousSurvey(question)
my_survey.store_response('English')
self.assertIn('English', my_survey.responses)
开发者ID:JennifferLockwood,项目名称:python_learning,代码行数:7,代码来源:test_survey_setUp_method.py
示例7: test_store_three_responses
def test_store_three_responses(self):
""" Testa se três respostas individuais são armazenada de forma apropriada."""
question = "What language did you first learn to speak?"
my_survey = AnonymousSurvey(question)
responses = ['English','Spanish', 'Mandarin']
for response in responses:
my_survey.store_response(response)
for response in responses:
self.assertIn(response, my_survey.responses)
开发者ID:weltonvaz,项目名称:Matthes,代码行数:10,代码来源:test_survey.py
示例8: test_store_three_responses
def test_store_three_responses(self):
"""test that three individual responses are stored properly"""
question = "What language did you first learn to speak?"
my_survey = AnonymousSurvey(question)
responses = ['English', 'Spanish', 'Mandarin']
for response in responses:
my_survey.store_response(response)
for response in responses:
self.assertIn(response, my_survey.responses)
开发者ID:monicamow,项目名称:pythoncrashcourse,代码行数:10,代码来源:test_survey.py
示例9: test_store_three_response
def test_store_three_response(self):
"""测试三个答案会被妥善的存储"""
question = "What language did you first learn to speak?"
my_survey = AnonymousSurvey(question)
responses = ['English','Spanish','Mandarin']
for response in responses:
my_survey.store_response(response)
for response in responses:
self.assertIn(response, my_survey.responses)
开发者ID:zhaojiawei123,项目名称:pythontest,代码行数:11,代码来源:test_survey.py
示例10: TestAnonymousSurvey
class TestAnonymousSurvey(unittest.TestCase):
def setUp(self):
question = "what language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Chinese', 'Japanese']
def test_store_single_response(self):
self.my_survey.store_response(self.responses[0])
self.assertIn(self.responses[0], self.my_survey.responses[0])
def test_store_three_response(self):
for response in self.responses :
self.my_survey.store_response(response)
for response in self.responses :
self.assertIn(response, self.my_survey.responses)
开发者ID:hidoos,项目名称:learn-python,代码行数:15,代码来源:test_survey.py
示例11: setUp
def setUp(self):
"""
Create a survey and a set of responses for use in all test methods.
"""
question = "What language dig you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Spanish', 'Mandarin']
开发者ID:JennifferLockwood,项目名称:python_learning,代码行数:7,代码来源:test_survey.py
示例12: setUp
def setUp(self):
"""
Создание опроса и набора ответов для всех тестовых методов.
"""
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Spanish', 'Mandarin']
开发者ID:yorza,项目名称:tests,代码行数:7,代码来源:test_survey.py
示例13: setUp
def setUp(self):
"""
创建一个调查对象和一组答案,供使用的测试方法使用
"""
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Spanish', 'Mandarin']
开发者ID:shucommon,项目名称:little-routine,代码行数:7,代码来源:test_survey.py
示例14: setUp
def setUp(self):
"""
Utworzenie ankiety i zestawu odpowiedzi do użycia
we wszystkich metodach testowych.
"""
question = "Jaki jest Twój ojczysty język?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['angielski', 'hiszpański', 'polski']
开发者ID:gorczynski,项目名称:python-crash-course,代码行数:8,代码来源:test_survey.py
示例15: TestAnonymousSurvey
class TestAnonymousSurvey(unittest.TestCase):
# 先运行setUp,再运行test_开头的函数
def setUp(self):
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Spanish', 'Mandarin']
# 测试单个响应是否存储成功
def test_store_single_response(self):
self.my_survey.store_response(self.responses[0])
self.assertIn(self.responses[0], self.my_survey.responses)
# 测试3个响应是否存储成功
def test_store_three_response(self):
for response in self.responses:
self.my_survey.store_response(response)
for response in self.responses:
self.assertIn(response, self.my_survey.responses)
开发者ID:lssxfy123,项目名称:PythonStudy,代码行数:20,代码来源:python_test2.py
示例16: TestAnonmyousSurvey
class TestAnonmyousSurvey(unittest.TestCase):
"""Тесты для класса AnonymousSurvey"""
def setUp(self):
"""
Создание опроса и набора ответов для всех тестовых методов.
"""
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Spanish', 'Mandarin']
def test_store_single_response(self):
"""Проверяет, что один ответ сохранен правильно."""
self.my_survey.store_response(self.responses[0])
self.assertIn(self.responses[0], self.my_survey.responses)
def test_store_three_responses(self):
"""Проверяет, что три ответа были сохранены правильно."""
for response in self.responses:
self.my_survey.store_response(response)
for response in self.responses:
self.assertIn(response, self.my_survey.responses)
开发者ID:yorza,项目名称:tests,代码行数:22,代码来源:test_survey.py
示例17: TestAnonmyousSurvey
class TestAnonmyousSurvey(unittest.TestCase):
def setUp(self):
"""
创建一个调查对象和一组答案,供使用的测试方法使用
"""
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Spanish', 'Mandarin']
def test_store_single_response(self):
self.my_survey.store_response(self.responses[0])
self.assertIn(self.responses[0], self.my_survey.responses)
def test_store_three_responses(self):
for response in self.responses:
self.my_survey.store_response(response)
for response in self.responses:
self.assertIn(response, self.my_survey.responses)
'''
开发者ID:shucommon,项目名称:little-routine,代码行数:22,代码来源:test_survey.py
示例18: TestAnonmyousSurvey
class TestAnonmyousSurvey(unittest.TestCase):
"""针对 AnonmyousSurvey 类的测试"""
# setUp() 方法, 让我们只需创建某些对象一次, 并在每个测试方法中都可以使用它们
# 如果在 TestCase 类中包含了 setUp(), Python 将先运行它, 再运行各个以 test_ 打头的方法
def setUp(self):
"""创建一个调查对象和一组答案, 供使用的测试方法使用"""
question = "你会什么语言?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['Swift', 'Python', 'JS']
def test_sotre_single_response(self):
"""测试单个答案会被妥善地存储"""
# question = "你会什么语言?" # 由于 setUp(), 进行修改
# my_survey = AnonymousSurvey(question) # 由于 setUp(), 进行修改
# my_survey.store_response('Python') # 由于 setUp(), 进行修改
self.my_survey.store_response(self.responses[0])
# 测试 my_survey.responses 中是否含有 'Python'
# self.assertIn('Python', my_survey.responses) # 由于 setUp(), 进行修改
self.assertIn(self.responses[0], self.my_survey.responses)
def test_store_three_response(self):
"""测试单个答案会被妥善存储"""
# question = "你会什么语言?" # 由于 setUp(), 进行修改
# my_survey = AnonymousSurvey(question) # 由于 setUp(), 进行修改
# responses = ['Swift', 'Python', 'JS'] # 由于 setUp(), 进行修改
# for response in responses: # 由于 setUp(), 进行修改
# my_survey.store_response(response) # 由于 setUp(), 进行修改
for response in self.responses:
self.my_survey.store_response(response)
# 测试 my_survey.responses 中是否含有 'Swift', 'Python', 'JS'
# for response in responses: # 由于 setUp(), 进行修改
# self.assertIn(response, my_survey.responses) # 由于 setUp(), 进行修改
for response in self.responses:
self.assertIn(response, self.my_survey.responses)
开发者ID:founderzhl,项目名称:Guibs_Python,代码行数:37,代码来源:test_survey.py
示例19: AnonymousSurvey
from survey import AnonymousSurvey
#定义一个问题,并创建一个表示调查的AnonyymousSurvey对象
question = "What language did you first learn to speak?"
my_survey = AnonymousSurvey(question)
#显示问题并存储答案
my_survey.show_question();
print("Enter 'q' at any time to quit.\n")
while True:
response = input("language:")
if response == 'q':
break
my_survey.store_response(response)
#显示调查结果
print("\nThank you to everyone who participated in the survey!")
my_survey.show_results()
开发者ID:zhaojiawei123,项目名称:pythontest,代码行数:18,代码来源:language_survey.py
示例20: setUp
def setUp(self):
"""创建一个调查对象和一组答案, 供使用的测试方法使用"""
question = "你会什么语言?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['Swift', 'Python', 'JS']
开发者ID:founderzhl,项目名称:Guibs_Python,代码行数:5,代码来源:test_survey.py
注:本文中的survey.AnonymousSurvey类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论