def test_CanAssignCard(self): c = Card() player = Player("Homer") c.assign_to(player) self.assertEqual(c.AssignedTo, "Homer")
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")])
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)])
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")])
def test_CanNotPullBlockedCard(self): column1 = Column() card = Card() card.lock() column1.push(card) column2 = Column() column2.pull_from(column1) self.assertEqual(len(column1.Cards), 1) self.assertEqual(len(column2.Cards), 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)])
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)])
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, [])
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))
def test_CanPushCardsIndependently(self): column1 = Column() column2 = Column() column1.push(Card()) self.assertEqual(len(column1.Cards), 1) self.assertEqual(len(column2.Cards), 0)
def test_CanUnlockCard(self): c = Card() c.lock() c.unlock() self.assertFalse(c.IsLocked)
def test_ByDefault_IsNotBlocked(self): c = Card() self.assertFalse(c.IsLocked)
def test_CanLockCard(self): c = Card() c.lock() self.assertTrue(c.IsLocked)
def __init__(self, number_of_cards=0, wip_limit=0): self._wip_limit = wip_limit self.Cards = [] for i in range(number_of_cards): self.Cards.append(Card())