def test_wait_without_eight_when_in_wait_state(self):
        hand = engine.Hand()
        hand.add_card(models.Card(models.Suit.clubs, models.Rank.ace))
        hand.add_card(models.Card(models.Suit.hearts, models.Rank.three))

        top_card = models.Card(models.Suit.clubs, models.Rank.eight)

        self.assertTrue(engine.valid_play(None, hand, top_card, engine.GameState.WAIT))
    def test_play_ace(self):
        hand = engine.Hand()
        hand.add_card(models.Card(models.Suit.hearts, models.Rank.ace))
        hand.add_card(models.Card(models.Suit.diamonds, models.Rank.six))

        top_card = models.Card(models.Suit.clubs, models.Rank.six)

        card = models.Card(models.Suit.hearts, models.Rank.ace)

        self.assertTrue(engine.valid_play(card, hand, top_card, engine.GameState.NORMAL))
    def test_play_card_not_in_hand(self):
        hand = engine.Hand()
        hand.add_card(models.Card(models.Suit.clubs, models.Rank.ace))
        hand.add_card(models.Card(models.Suit.diamonds, models.Rank.four))

        top_card = models.Card(models.Suit.clubs, models.Rank.four)

        card = models.Card(models.Suit.spades, models.Rank.four)

        self.assertFalse(engine.valid_play(card, hand, top_card, engine.GameState.NORMAL))
    def test_play_four_when_in_pick_with_four(self):
        hand = engine.Hand()
        hand.add_card(models.Card(models.Suit.clubs, models.Rank.ace))
        hand.add_card(models.Card(models.Suit.diamonds, models.Rank.four))

        top_card = models.Card(models.Suit.clubs, models.Rank.four)

        card = models.Card(models.Suit.diamonds, models.Rank.four)

        self.assertTrue(engine.valid_play(card, hand, top_card, engine.GameState.PICK))
    def test_play_non_two_when_in_pick_with_two(self):
        hand = engine.Hand()
        hand.add_card(models.Card(models.Suit.clubs, models.Rank.ace))
        hand.add_card(models.Card(models.Suit.clubs, models.Rank.four))

        top_card = models.Card(models.Suit.clubs, models.Rank.two)

        card = models.Card(models.Suit.clubs, models.Rank.four)

        self.assertFalse(engine.valid_play(card, hand, top_card, engine.GameState.PICK))
    def test_play_when_in_wait(self):
        hand = engine.Hand()
        hand.add_card(models.Card(models.Suit.clubs, models.Rank.ace))
        hand.add_card(models.Card(models.Suit.clubs, models.Rank.four))

        top_card = models.Card(models.Suit.clubs, models.Rank.eight)

        card = models.Card(models.Suit.clubs, models.Rank.four)

        self.assertFalse(engine.valid_play(card, hand, top_card, engine.GameState.WAIT))