예제 #1
0
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')
        )
예제 #2
0
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'))
예제 #3
0
 def setUp(self):
     self.tieBreaker = TieBreaker(['a', 'b', 'c', 'd'])
     self.tieBreaker.random_ordering = ['a', 'b', 'c', 'd']
예제 #4
0
 def setUp(self):
     self.tieBreaker = TieBreaker(['a', 'b', 'c', 'd'])
     self.tieBreaker.random_ordering = ['a', 'b', 'c', 'd']