class TestTieBreaker(unittest.TestCase): def setUp(self): self.tieBreaker = TieBreaker(['a', 'b', 'c', 'd']) self.tieBreaker.random_ordering = ['a', 'b', 'c', 'd'] def test_simple_tie(self): self.assertEqual( self.tieBreaker.break_ties(set(['b', 'c'])), 'b' ) def test_simple_tie_reverse(self): self.assertEqual( self.tieBreaker.break_ties(set(['b', 'c']), reverse=True), 'c' ) def test_tuple_tie(self): self.assertEqual( self.tieBreaker.break_ties(set([('c', 'a'), ('b', 'd'), ('c', 'b')])), ('b', 'd') ) def test_tuple_tie_reverse(self): self.assertEqual( self.tieBreaker.break_ties(set([('c', 'a'), ('b', 'd'), ('c', 'b')]), reverse=True), ('c', 'b') )
class TestTieBreaker(unittest.TestCase): def setUp(self): self.tieBreaker = TieBreaker(['a', 'b', 'c', 'd']) self.tieBreaker.random_ordering = ['a', 'b', 'c', 'd'] def test_simple_tie(self): self.assertEqual(self.tieBreaker.break_ties(set(['b', 'c'])), 'b') def test_simple_tie_reverse(self): self.assertEqual( self.tieBreaker.break_ties(set(['b', 'c']), reverse=True), 'c') def test_tuple_tie(self): self.assertEqual( self.tieBreaker.break_ties( set([('c', 'a'), ('b', 'd'), ('c', 'b')])), ('b', 'd')) def test_tuple_tie_reverse(self): self.assertEqual( self.tieBreaker.break_ties(set([('c', 'a'), ('b', 'd'), ('c', 'b')]), reverse=True), ('c', 'b'))
def setUp(self): self.tieBreaker = TieBreaker(['a', 'b', 'c', 'd']) self.tieBreaker.random_ordering = ['a', 'b', 'c', 'd']