def testBallotEQ8(self): "test profile compare with equal rankings" b1 = '''3 2 4 1 2=3 0 2 2=3 0 0 "Castor" "Pollux" "Helen" "Pollux and Helen should tie"''' b2 = '''3 2 4 1 2=3 0 2 2=3 0 0 "Castor" "Pollux" "Helen" "Pollux and Helen should tie"''' b3 = '''3 2 3 1 2=3 0 3 2=3 0 0 "Castor" "Pollux" "Helen" "Pollux and Helen should tie"''' b4 = '''3 2 4 1 2=3 0 2 2=1 0 0 "Castor" "Pollux" "Helen" "Pollux and Helen should tie"''' p1 = ElectionProfile(data=b1) p2 = ElectionProfile(data=b2) self.assertFalse(p1.compare(p2)) p3 = ElectionProfile(data=b3) p4 = ElectionProfile(data=b4) self.assertTrue(p1.compare(p3)) self.assertTrue(p1.compare(p4))
def testBallotEQ8(self): "test profile compare with equal rankings" b1 = '''3 2 4 1 2=3 0 2 2=3 0 0 "Castor" "Pollux" "Helen" "Pollux and Helen should tie"''' b2 = '''3 2 4 1 2=3 0 2 2=3 0 0 "Castor" "Pollux" "Helen" "Pollux and Helen should tie"''' b3 = '''3 2 3 1 2=3 0 3 2=3 0 0 "Castor" "Pollux" "Helen" "Pollux and Helen should tie"''' b4 = '''3 2 4 1 2=3 0 2 2=1 0 0 "Castor" "Pollux" "Helen" "Pollux and Helen should tie"''' p1 = ElectionProfile(data=b1) p2 = ElectionProfile(data=b2) self.assertFalse(p1.compare(p2)) p3 = ElectionProfile(data=b3) p4 = ElectionProfile(data=b4) self.assertTrue(p1.compare(p3)) self.assertTrue(p1.compare(p4))
def testCompareFile(self): "normal init from file: 2 seats" path = testdir + '/blt/42.blt' pd = ElectionProfile(data=p_42) pp = ElectionProfile(path) self.assertFalse(pp.compare(pd), 'compare election 42 from file vs data blob')
def testCompareFile(self): "normal init from file: 2 seats" path = testdir + '/blt/42.blt' pd = ElectionProfile(data=p_42) pp = ElectionProfile(path) self.assertFalse(pp.compare(pd), 'compare election 42 from file vs data blob')