def test_store_three_response(self): question = "What language did you first learn to speak?" my_survey = AnonymousSurvey(question) responses = ['English','Chinese','Spanish'] for response in responses: my_survey.show_responses(response) for response in responses: self.assertIn(response,my_survey.responses)
# -*- coding:utf-8 -*- # Filename: language_survey.py # Author: Lizi # Time: 2019/12/22 11:10 from survey import AnonymousSurvey question = "What language did you first learn to speak?" my_survey = AnonymousSurvey(question) my_survey.show_questions() while True: response = input("Language: ") if response == 'q': break my_survey.show_responses(response) my_survey.show_result()
def test_store_single_response(self): question = "What language did you first learn to speak?" my_survey = AnonymousSurvey(question) my_survey.show_responses('English') self.assertIn('English',my_survey.responses)