当前位置: 首页>>代码示例>>Python>>正文


Python survey.AnonymousSurvey类代码示例

本文整理汇总了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)
开发者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


注:本文中的survey.AnonymousSurvey类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。