本文整理汇总了Python中survey.AnonymousSurvey类的典型用法代码示例。如果您正苦于以下问题:Python AnonymousSurvey类的具体用法?Python AnonymousSurvey怎么用?Python AnonymousSurvey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AnonymousSurvey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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']
示例12: setUp
def setUp(self):
"""
Создание опроса и набора ответов для всех тестовых методов.
"""
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Spanish', 'Mandarin']
示例13: setUp
def setUp(self):
"""
创建一个调查对象和一组答案,供使用的测试方法使用
"""
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
self.responses = ['English', 'Spanish', 'Mandarin']
示例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']
示例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)