Esempio n. 1
0
	def testC_increment3 (self):
		c = Candidate("Josh", 1)
		c.increment([1, 2, 3])
		c.increment([1, 2, 3])
		c.increment([1, 3, 2])
		self.assertEqual(c.count, 3)
		self.assertEqual(c.ballots, [[1, 2, 3], [1, 2, 3], [1, 3, 2]])
Esempio n. 2
0
 def test_candidate4(self):
     candidate = Candidate('John Doe')
     candidate.add(Ballot(''))
     candidate.add(Ballot(''))
     candidate.add(Ballot(''))
     self.assert_(str(candidate) == 'John Doe')
     self.assert_(candidate.numVotes() == 3)
Esempio n. 3
0
	def test_candidate4 (self):
		candidate = Candidate('John Doe')
		candidate.add(Ballot(''))
		candidate.add(Ballot(''))
		candidate.add(Ballot(''))
		self.assert_(str(candidate) == 'John Doe')
		self.assert_(candidate.numVotes() == 3)
Esempio n. 4
0
	def testC_increment2 (self):
		c = Candidate("Fiona", 1)
		c.increment([1, 2, 3])
		self.assertEqual(c.count, 1)
		self.assertEqual(c.ballots, [[1, 2, 3]])
Esempio n. 5
0
	def testC_increment1 (self):
		c = Candidate("Prateek", 1)
		c.increment([1, 2])
		self.assertEqual(c.count, 1)
		self.assertEqual(c.ballots, [[1, 2]])
Esempio n. 6
0
	def testCgetinfo3 (self):
		c = Candidate("Glenn Downing", 500)
		c.count = 2
		c.ballots.append([1, 2, 3])
		c.ballots.append([1, 3, 2])
		self.assertEqual(c.getinfo(), ('Glenn Downing', 500, 2, [[1, 2, 3], [1, 3, 2]], True))
Esempio n. 7
0
	def testCgetinfo2 (self):
		c = Candidate("Mitt Romney", 1)
		c.count = 1
		c.ballots.append([1, 2, 3])
		self.assertEqual(c.getinfo(), ('Mitt Romney', 1, 1, [[1, 2, 3]], True))
Esempio n. 8
0
	def testCgetinfo1 (self):
		c = Candidate("Barack Obama", 1)
		c.count = 1
		c.ballots.append(1)
		c.running = False
		self.assertEqual(c.getinfo(), ('Barack Obama', 1, 1, [1], False))
Esempio n. 9
0
	def test_candidate2 (self):
		candidate = Candidate('John Doe')
		self.assert_(str(candidate) == 'John Doe')
		self.assert_(candidate.numVotes() == 0)
Esempio n. 10
0
	def test_candidate1 (self):
		candidate = Candidate('')
		self.assert_(str(candidate) == '')
		self.assert_(candidate.numVotes() == 0)
Esempio n. 11
0
 def test_candidate2(self):
     candidate = Candidate('John Doe')
     self.assert_(str(candidate) == 'John Doe')
     self.assert_(candidate.numVotes() == 0)
Esempio n. 12
0
 def test_candidate1(self):
     candidate = Candidate('')
     self.assert_(str(candidate) == '')
     self.assert_(candidate.numVotes() == 0)