Exemple #1
0
class TestCandidateVotes(TestCase):
    def setUp(self):
        self.cand = Candidate("Smith, Joe", "GOP")

    def test_default_zero_votes(self):
        "Candidate vote count should default to zero"
        self.assertEquals(self.cand.votes, 0)

    def test_vote_count_update(self):
        "Candidate.add_votes method should update vote count"
        self.cand.add_votes("Some County", 20)
        self.assertEquals(self.cand.votes, 20)

    def test_county_results_access(self):
        "Candidate.add_votes method should store county results"
        self.cand.add_votes("Some County", 20)
        expected = {"Some County": 20}
        self.assertEquals(self.cand.county_results, expected)
class TestCandidateVotes(TestCase):

    def setUp(self):
        self.cand = Candidate("Smith, Joe", "GOP")

    def test_default_zero_votes(self):
        "Candidate vote count should default to zero"
        self.assertEquals(self.cand.votes, 0)

    def test_vote_count_update(self):
        "Candidate.add_votes method should update vote count"
        self.cand.add_votes("Some County", 20)
        self.assertEquals(self.cand.votes, 20)

    def test_county_results_access(self):
        "Candidate.add_votes method should store county results"
        self.cand.add_votes("Some County", 20)
        expected = { "Some County": 20 }
        self.assertEquals(self.cand.county_results, expected)