def test_cards(self): card1 = AbstractCard(1001, 0, 1, 2, 3001) # TEST self.assertEqual(card1.color, 0, 'card1.color is sane.') # TEST self.assertEqual(card1.rank, 2, 'card1.rank') card2 = AbstractCard(1001, 0, 3, 7, 3001) # TEST self.assertEqual(card2.color, 1, 'card2.color is sane.') # TEST self.assertEqual(card2.rank, 7, 'card2.rank')
def __init__(self, g): self.cards = [ AbstractCard(1000 + r * 100 + s * 10, 0, s, r, g) for s in range(4) for r in range(13) ] for c in self.cards: c.item = MockItem()
def shlomif_main(args): plan(4) card1 = AbstractCard(1001, 0, 1, 2, 3001) # TEST ok(card1.color == 0, 'card1.color is sane.') # TEST ok(card1.rank == 2, 'card1.rank') card2 = AbstractCard(1001, 0, 3, 7, 3001) # TEST ok(card2.color == 1, 'card2.color is sane.') # TEST ok(card2.rank == 7, 'card2.rank')
def _calc_Spider_stack(self): g = MockGame() stack = Spider_RowStack(0, 0, g) for s, r in [(2, 5), (3, 7), (2, 7), (2, 0), (2, 3), (2, 5), (1, 4)]: c = AbstractCard(1000+r*100+s*10, 0, s, r, g) c.face_up = True c.item = MockItem() stack.addCard(c) return stack
def _calc_Scorpion_stack(self, isScorpionTail): g = MockGame() stack = (ScorpionTail_RowStack if isScorpionTail else Scorpion_RowStack)(0, 0, g) for s, r in [(2, 5), (3, 7), (2, 7), (2, 0), (2, 3), (2, 4), (1, 4)]: c = AbstractCard(1000 + r * 100 + s * 10, 0, s, r, g) c.face_up = True c.item = MockItem() stack.addCard(c) return stack
def test_output(self): card = AbstractCard(1001, 0, 3, 7, 3001) h = Base_Solver_Hint(None, None, base_rank=0) got = h.card2str2(card) # TEST self.assertEqual(got, 'D-8', 'card2str2 works') # diag('got == ' + got) got = h.card2str1(card) # TEST self.assertEqual(got, '8D', 'card2str2 works')
def test_import(self): g = MockGame() stack = Scorpion_RowStack(0, 0, g) cards = [ AbstractCard(1000 + r * 100 + s * 10, 0, s, r, g) for s, r in [(2, 5), (3, 7), (2, 7), (2, 0), (2, 3), (2, 4), (1, 4)] ] for c in cards: c.face_up = True c.item = MockItem() stack.addCard(c) stack.canMoveCards(stack.cards[6:]) self.assertTrue(stack)