Esempio n. 1
0
 def test_bid_parsing_special_bids(self):
     b = Bid.from_string('pass', 0)
     nose.tools.assert_true(b.bidType == 'pass')
     b = Bid.from_string('double', 0)
     nose.tools.assert_true(b.bidType == 'double')
     b = Bid.from_string('redouble', 0)
     nose.tools.assert_true(b.bidType == 'redouble')
Esempio n. 2
0
 def test_bid_parsing_special_bids(self):
     b = Bid.from_string('pass', 0)
     nose.tools.assert_true(b.bidType == 'pass')
     b = Bid.from_string('double', 0)
     nose.tools.assert_true(b.bidType == 'double')
     b = Bid.from_string('redouble', 0)
     nose.tools.assert_true(b.bidType == 'redouble')
Esempio n. 3
0
 def test_legal_bids(self):
     for test_sequence, actual_legal in self.test_bid_sequences:
         bid_list = [Bid.from_string(b, i) for i, b in enumerate(test_sequence)]
         legal_bids = []
         for i, bid in enumerate(bid_list):
             legal_bids.append(Match.legal_bid(bid, bid_list[:i], i % 4, (i +2) % 4))
                         
         nose.tools.assert_list_equal(legal_bids, actual_legal, msg='Bid sequence {0} failed'.format(test_sequence))
Esempio n. 4
0
    def test_legal_bids(self):
        for test_sequence, actual_legal in self.test_bid_sequences:
            bid_list = [
                Bid.from_string(b, i) for i, b in enumerate(test_sequence)
            ]
            legal_bids = []
            for i, bid in enumerate(bid_list):
                legal_bids.append(
                    Match.legal_bid(bid, bid_list[:i], i % 4, (i + 2) % 4))

            nose.tools.assert_list_equal(
                legal_bids,
                actual_legal,
                msg='Bid sequence {0} failed'.format(test_sequence))
Esempio n. 5
0
 def test_bid_parsing_valid(self):
     for i in range(1, 8):
         for s in BIDDING_SUITS:
             Bid.from_string(str(i) + s, 0)
Esempio n. 6
0
 def test_bid_parsing_nosuit(self):
     Bid.from_string('2', 0)
Esempio n. 7
0
 def test_bid_parsing_invalid(self):
     Bid.from_string('one no trump', 0)
Esempio n. 8
0
 def test_bid_parsing_novalue(self):
     Bid.from_string('nt', 0)
Esempio n. 9
0
 def test_bid_parsing_high(self):
     Bid.from_string('8s', 0)
Esempio n. 10
0
 def test_bid_parsing_low(self):
     Bid.from_string('0s', 0)
Esempio n. 11
0
 def test_bid_parsing_valid(self):
     for i in range(1,8):
         for s in BIDDING_SUITS:
             Bid.from_string(str(i)+s, 0)
Esempio n. 12
0
 def test_bid_parsing_nosuit(self):    
     Bid.from_string('2', 0)
Esempio n. 13
0
 def test_bid_parsing_invalid(self):    
     Bid.from_string('one no trump', 0)
Esempio n. 14
0
 def test_bid_parsing_novalue(self):    
     Bid.from_string('nt', 0)
Esempio n. 15
0
 def test_bid_parsing_high(self):    
     Bid.from_string('8s', 0)
Esempio n. 16
0
 def test_bid_parsing_low(self):    
     Bid.from_string('0s', 0)