Пример #1
0
    def test_csv_from_string_with_quiz(self):
        # ARRANGE
        test_file = textwrap.dedent("""\
            "Timestamp","Teamnaam","Vraag 1","Vraag 2","Vraag 3"
            "2020/10/30 3:08:44 PM GMT+1","Correct answers","Antwoord 1","Antwoord 2","Antwoord 3"
            "2020/10/30 3:08:44 PM GMT+1","test","Antwoord 5","Antwoord 2","Antwoord 1"
        """)
        quiz = Quiz()

        # ACT
        section = Section.read_csv(io.StringIO(test_file), quiz=quiz)

        # ASSERT
        self.assertEqual(len(quiz.teams), 1)
Пример #2
0
    def test_csv_from_string(self):
        # ARRANGE
        test_file = textwrap.dedent("""\
            "Timestamp","Teamnaam","Vraag 1","Vraag 2","Vraag 3"
            "2020/10/30 3:08:44 PM GMT+1","Correct answers","Antwoord 1","Antwoord 2","Antwoord 3"
            "2020/10/30 3:08:44 PM GMT+1","test","Antwoord 5","Antwoord 2","Antwoord 1"
        """)

        # ACT
        section = Section.read_csv(io.StringIO(test_file))

        # ASSERT
        self.assertIsInstance(section, Section)
        self.assertEqual(len(section.responses), 1)
        self.assertIsInstance(section.responses[0].team, Team)