示例#1
0
	def test_ballot4 (self):
		ballot = Ballot(' 2  3\t5\t\t7 \t')
		self.assert_(str(ballot) == '[2, 3, 5, 7]')
		self.assert_(ballot.getVote() == 2)
		self.assert_(ballot.getVote() == 3)
		self.assert_(ballot.getVote() == 5)
		self.assert_(ballot.getVote() == 7)
示例#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)
示例#3
0
	def test_ballot3 (self):
		ballot = Ballot('2 3 5 7')
		self.assert_(str(ballot) == '[2, 3, 5, 7]')
		self.assert_(ballot.getVote() == 2)
		self.assert_(ballot.getVote() == 3)
		self.assert_(ballot.getVote() == 5)
		self.assert_(ballot.getVote() == 7)
示例#4
0
 def test_ballot4(self):
     ballot = Ballot(' 2  3\t5\t\t7 \t')
     self.assert_(str(ballot) == '[2, 3, 5, 7]')
     self.assert_(ballot.getVote() == 2)
     self.assert_(ballot.getVote() == 3)
     self.assert_(ballot.getVote() == 5)
     self.assert_(ballot.getVote() == 7)
示例#5
0
 def test_ballot3(self):
     ballot = Ballot('2 3 5 7')
     self.assert_(str(ballot) == '[2, 3, 5, 7]')
     self.assert_(ballot.getVote() == 2)
     self.assert_(ballot.getVote() == 3)
     self.assert_(ballot.getVote() == 5)
     self.assert_(ballot.getVote() == 7)
 def test_Ballot_class6(self):
     ballot = Ballot([5,6,7])
     self.assertEqual(ballot.get_next(2),7)
 def test_Ballot_class3(self):
     ballot = Ballot([1,2,3])
     self.assertEqual(ballot.get_next(2),3)
示例#8
0
	def testB_getchoice2 (self):
		b = Ballot([1, 2, 3])
		b.marker += 1
		self.assertEqual(b.getchoice(), 2)
示例#9
0
	def testB_getchoice1 (self):
		b = Ballot([1, 2, 3])
		self.assertEqual(b.getchoice(), 1)
示例#10
0
	def testB_getinfo3 (self):
		b = Ballot([1, 2, 3])
		self.assertEqual(b.getinfo(), ([1, 2, 3], 0))
示例#11
0
	def testB_getinfo2 (self):
		b = Ballot([1, 10, 100, 1000])
		b.marker += 2
		self.assertEqual(b.getinfo(), ([1, 10, 100, 1000], 2))
示例#12
0
	def testB_getinfo1 (self):
		b = Ballot([1])
		self.assertEqual(b.getinfo(), ([1], 0))
示例#13
0
	def test_ballot2 (self):
		ballot = Ballot('2')
		self.assert_(str(ballot) == '[2]')
		self.assert_(ballot.getVote() == 2)
示例#14
0
 def test_ballot2(self):
     ballot = Ballot('2')
     self.assert_(str(ballot) == '[2]')
     self.assert_(ballot.getVote() == 2)
示例#15
0
 def test_ballot1(self):
     ballot = Ballot('')
     self.assert_(str(ballot) == '[]')