예제 #1
0
    def test_votes(self):
        options = ["1", "2", "3"]
        poll = Poll(13, "TestTitle", options)

        self.assertEqual(poll.get_winners(), ["1", "2", "3"])

        poll.vote("Wilma", "1")
        poll.vote("Fred", "2")

        self.assertEqual(poll.get_winners(), ["1", "2"])
예제 #2
0
    def test_constructor(self):
        options = ["1", "2", "3"]
        poll = Poll(13, "TestTitle", options)
        self.assertEqual(poll.title, "TestTitle")
        self.assertEqual(poll.id, 13)

        self.assertEqual(poll.get_winners(), ["1", "2", "3"])