def test_election3(self): reader = StringIO.StringIO('2\nJohn Doe\nJane Smith\n') election = Election() election.readCandidates(reader) self.assert_(len(election.candidates) == 2) self.assert_(str(election.candidates[0]) == 'John Doe') self.assert_(str(election.candidates[1]) == 'Jane Smith')
def test_election3 (self): reader = StringIO.StringIO('2\nJohn Doe\nJane Smith\n') election = Election() election.readCandidates(reader) self.assert_(len(election.candidates) == 2) self.assert_(str(election.candidates[0]) == 'John Doe') self.assert_(str(election.candidates[1]) == 'Jane Smith')
def test_election6 (self): reader = StringIO.StringIO('1 2 3 4\n2 3 5 7\n') election = Election() election.readBallots(reader) self.assert_(len(election.ballots) == 2) self.assert_(str(election.ballots[0]) == '[1, 2, 3, 4]') self.assert_(str(election.ballots[1]) == '[2, 3, 5, 7]')
def test_election6(self): reader = StringIO.StringIO('1 2 3 4\n2 3 5 7\n') election = Election() election.readBallots(reader) self.assert_(len(election.ballots) == 2) self.assert_(str(election.ballots[0]) == '[1, 2, 3, 4]') self.assert_(str(election.ballots[1]) == '[2, 3, 5, 7]')
def test_election7 (self): reader = StringIO.StringIO('2\nJohn Doe\nJane Smith\n1 2 3 4\n2 3 5 7\n') election = Election() election.read(reader) self.assert_(len(election.candidates) == 2) self.assert_(str(election.candidates[0]) == 'John Doe') self.assert_(str(election.candidates[1]) == 'Jane Smith') self.assert_(len(election.ballots) == 2) self.assert_(str(election.ballots[0]) == '[1, 2, 3, 4]') self.assert_(str(election.ballots[1]) == '[2, 3, 5, 7]')
def main(): numElections = read(sys.stdin) while numElections > 0: election = Election() election.read(sys.stdin) election.evaluate() print election numElections -= 1
def test_election7(self): reader = StringIO.StringIO( '2\nJohn Doe\nJane Smith\n1 2 3 4\n2 3 5 7\n') election = Election() election.read(reader) self.assert_(len(election.candidates) == 2) self.assert_(str(election.candidates[0]) == 'John Doe') self.assert_(str(election.candidates[1]) == 'Jane Smith') self.assert_(len(election.ballots) == 2) self.assert_(str(election.ballots[0]) == '[1, 2, 3, 4]') self.assert_(str(election.ballots[1]) == '[2, 3, 5, 7]')
def test_election4 (self): reader = StringIO.StringIO('') election = Election() election.readBallots(reader) self.assert_(len(election.ballots) == 0) self.assert_(election.ballots == [])
def test_election2 (self): reader = StringIO.StringIO('1\nJohn Doe\n') election = Election() election.readCandidates(reader) self.assert_(len(election.candidates) == 1) self.assert_(str(election.candidates[0]) == 'John Doe')
def test_election1 (self): reader = StringIO.StringIO('') election = Election() election.readCandidates(reader) self.assert_(len(election.candidates) == 0)
def test_election5 (self): reader = StringIO.StringIO('1 2 3 4\n') election = Election() election.readBallots(reader) self.assert_(len(election.ballots) == 1) self.assert_(str(election.ballots[0]) == '[1, 2, 3, 4]')
def test_election4(self): reader = StringIO.StringIO('') election = Election() election.readBallots(reader) self.assert_(len(election.ballots) == 0) self.assert_(election.ballots == [])
def test_election2(self): reader = StringIO.StringIO('1\nJohn Doe\n') election = Election() election.readCandidates(reader) self.assert_(len(election.candidates) == 1) self.assert_(str(election.candidates[0]) == 'John Doe')
def test_election1(self): reader = StringIO.StringIO('') election = Election() election.readCandidates(reader) self.assert_(len(election.candidates) == 0)
def test_election5(self): reader = StringIO.StringIO('1 2 3 4\n') election = Election() election.readBallots(reader) self.assert_(len(election.ballots) == 1) self.assert_(str(election.ballots[0]) == '[1, 2, 3, 4]')