Esempio n. 1
0
    def _board_from_request(self):
        board_number = int(self.request.get('number'))
        vulnerability_string = self.request.get('vunerability')
        hand_strings = map(str, [
            self.request.get('deal[north]'),
            self.request.get('deal[east]'),
            self.request.get('deal[south]'),
            self.request.get('deal[west]'),
        ])

        deal = Deal.from_string(' '.join(hand_strings))
        dealer_char = self.request.get('dealer')
        calls_string = self.request.get('calls_string', '')
        history = CallHistory.from_string(calls_string, dealer_char, vulnerability_string)
        return Board(board_number, deal, history)
Esempio n. 2
0
    def _board_from_request(self):
        board_number = int(self.request.get('number'))
        vulnerability_string = self.request.get('vunerability')
        hand_strings = map(str, [
            self.request.get('deal[north]'),
            self.request.get('deal[east]'),
            self.request.get('deal[south]'),
            self.request.get('deal[west]'),
        ])

        deal = Deal.from_string(' '.join(hand_strings))
        dealer_char = self.request.get('dealer')
        # Note: We keep bids_string around to I can test old requests.
        calls_string = self.request.get('calls_string') or self.request.get('bids_string') or ''
        history = CallHistory.from_string(calls_string, dealer_char, vulnerability_string)
        return Board(board_number, deal, history)
Esempio n. 3
0
    def _board_from_request(self):
        board_number = int(self.request.get("number"))
        vulnerability_string = self.request.get("vunerability")
        hand_strings = map(
            str,
            [
                self.request.get("deal[north]"),
                self.request.get("deal[east]"),
                self.request.get("deal[south]"),
                self.request.get("deal[west]"),
            ],
        )

        deal = Deal.from_string(" ".join(hand_strings))
        dealer_char = self.request.get("dealer")
        # Note: We keep bids_string around to I can test old requests.
        calls_string = self.request.get("calls_string") or self.request.get("bids_string") or ""
        history = CallHistory.from_string(calls_string, dealer_char, vulnerability_string)
        return Board(board_number, deal, history)
Esempio n. 4
0
 def test_identifier(self):
     deal = Deal.from_string("23456789TJQKA... .23456789TJQKA.. ..23456789TJQKA. ...23456789TJQKA")
     self.assertEquals(deal.identifier, '0000001555555aaaaaabffffff')
     self.assertEquals(deal.pretty_one_line(), Deal.from_identifier(deal.identifier).pretty_one_line())
Esempio n. 5
0
 def test_random(self):
     # Just make sure the random code path does not assert, and returns something non-None.
     self.assertTrue(bool(Deal.random()))