Пример #1
0
    def test_Play_CoinFlipsTails_StartsNewCard(self):
        homer = Player("Homer")
        game = Create.game() \
            .with_inbox_column([Card()]) \
            .please()

        homer.play(game, COIN_TAILS)

        self.assertEqual(game.column("Development").Cards, [Card("Homer")])
Пример #2
0
    def test_Play_CoinFlipsTails_HasNoCards_DoNothing(self):
        homer = Player("Homer")
        game = Create \
            .game() \
            .please()

        homer.play(game, COIN_TAILS)

        self.assertEqual(game.column("Development").Cards, [])
        self.assertEqual(game.column("Testing").Cards, [])
Пример #3
0
    def test_Play_CoinFlipsTails_HasAssignedBlockedCardInTesting_UnblocksTheCard(
            self):
        homer = Player("Homer")
        game = Create \
            .game() \
            .with_testing_column([Card("Homer", True)]) \
            .please()

        homer.play(game, COIN_TAILS)

        self.assertEqual(game.column("Testing").Cards, [Card("Homer", False)])
Пример #4
0
    def test_Play_CoinFlipsTails_HasAssignedCardInTesting_MovesTheCardToDone(
            self):
        homer = Player("Homer")
        game = Create.game() \
            .with_testing_column([Card("Homer")]) \
            .please()

        homer.play(game, COIN_TAILS)

        self.assertEqual(game.column("Testing").Cards, [])
        self.assertEqual(game.column("Done").Cards, [Card("Homer")])
Пример #5
0
    def test_PlayWithWipLimits_CoinFlipsHeads_BlockAndRespectWipLimit(self):
        homer = Player("Homer")
        game = Create.game() \
            .with_inbox_column([Card()]) \
            .with_development_column(cards=[Card("Homer", False)], wip_limit=1) \
            .with_testing_column(cards=[Card("Homer", True)], wip_limit=1) \
            .please()

        homer.play(game, COIN_HEADS)

        self.assertEqual(
            game.column("Development").Cards, [Card("Homer", True)])
        self.assertEqual(game.column("Testing").Cards, [Card("Homer", True)])
Пример #6
0
    def test_Play_CoinFlipsHeads_HasCardInDevelopment_BlocksTheCardAndStartsNewCard(
            self):
        homer = Player("Homer")
        game = Create \
            .game() \
            .with_inbox_column([Card()]) \
            .with_development_column([Card("Homer", False)]) \
            .please()

        homer.play(game, COIN_HEADS)

        self.assertEqual(
            game.column("Development").Cards,
            [Card("Homer", True), Card("Homer", False)])
Пример #7
0
    def test_PlayWithWipLimits_CoinFlipsTails_HelpOthersWithDevelopmentIfCanNotWorkOnMyCards(
            self):
        homer = Player("Homer")
        game = Create.game() \
            .with_inbox_column([Card()]) \
            .with_development_column(cards=[Card("Marge")], wip_limit=1) \
            .with_testing_column(cards=[], wip_limit=1) \
            .please()

        homer.play(game, COIN_TAILS)

        self.assertEqual(game.column("Development").Cards, [])
        self.assertEqual(game.column("Testing").Cards, [Card("Marge")])
        self.assertEqual(game.column("Done").Cards, [])
Пример #8
0
    def test_CanAssignCard(self):
        c = Card()
        player = Player("Homer")

        c.assign_to(player)

        self.assertEqual(c.AssignedTo, "Homer")
Пример #9
0
    def test_Play():
        homer = Player("Homer")
        marge = Player("Marge")
        bart = Player("Bart")
        liza = Player("Liza")
        maggie = Player("Maggie")
        coin = Coin()
        done_cards = []

        for game_count in range(1000):
            inbox = []
            for card_count in range(20):
                inbox.append(Card())
            game = Create.game() \
                .with_inbox_column(inbox) \
                .with_development_column([], 7) \
                .with_testing_column([], 7) \
                .please()

            for steps_count in range(20):
                homer.play(game, coin)
                marge.play(game, coin)
                bart.play(game, coin)
                liza.play(game, coin)
                maggie.play(game, coin)

            done_cards.append(len(game.column("Done").Cards))

        print(done_cards)
        print(np.mean(done_cards))
Пример #10
0
 def test_PlayerMustHaveName(self):
     homer = Player("Homer")
     self.assertEqual(homer.Name, "Homer")