예제 #1
0
def test_flip_toggles_card_facing_direction():
    card = PlayingCard(2, 's')

    card.flip()
    assert_true(card.is_face_up())

    card.flip()
    assert_false(card.is_face_up())
예제 #2
0
def test_push_and_get_card():
	card = PlayingCard('A', 's')
	card.flip()
	pile = TablePile()
	pile.add_card(card)

	assert_equal(1, len(pile))
	assert_equal(card.rank, pile[0].rank)
	assert_equal(card.suit, pile[0].suit)
예제 #3
0
def test_draw_on_empty_pile_flips_discard_pile_to_draw_pile():
	game = Game(no_shuffle=True)
	card = PlayingCard('A', 's')
	card.flip()
	game.piles[1].add_card(card)

	game.draw()

	assert_equal(1, len(game.piles[0]))
	assert_equal(0, len(game.piles[1]))
예제 #4
0
def test_draw_table_pile_row():
	card = PlayingCard('A', 's')
	card1 = PlayingCard(2, 's')
	card1.flip()
	pile0 = TablePile()
	pile1 = TablePile()
	pile1.append(card)
	pile2 = TablePile()
	pile2.append(card)
	pile2.append(card1)
	piles = [pile0, pile1, pile2, pile0, pile1, pile2, pile0]

	result = draw_table_pile_row(piles, 0)

	assert_equal('            \033[30;47m 2 s \033[0m             \033[30;47m 2 s \033[0m      ', result)
예제 #5
0
def test_draw_table_pile_summary_row():
	card = PlayingCard('A', 's')
	card1 = PlayingCard(2, 's')
	card1.flip()
	pile0 = TablePile()
	pile1 = TablePile()
	pile1.append(card)
	pile2 = TablePile()
	pile2.append(card)
	pile2.append(card1)
	piles = [pile0, pile1, pile2, pile0, pile1, pile2, pile0]

	result = draw_table_pile_summary_row(piles)

	assert_equal('0---- 1---- 1---- 0---- 1---- 1---- 0----', result)
예제 #6
0
def test_draw_table_pile_summary_row():
    card = PlayingCard('A', 's')
    card1 = PlayingCard(2, 's')
    card1.flip()
    pile0 = TablePile()
    pile1 = TablePile()
    pile1.append(card)
    pile2 = TablePile()
    pile2.append(card)
    pile2.append(card1)
    piles = [pile0, pile1, pile2, pile0, pile1, pile2, pile0]

    result = draw_table_pile_summary_row(piles)

    assert_equal('0---- 1---- 1---- 0---- 1---- 1---- 0----', result)
예제 #7
0
def test_draw_table_pile_row():
    card = PlayingCard('A', 's')
    card1 = PlayingCard(2, 's')
    card1.flip()
    pile0 = TablePile()
    pile1 = TablePile()
    pile1.append(card)
    pile2 = TablePile()
    pile2.append(card)
    pile2.append(card1)
    piles = [pile0, pile1, pile2, pile0, pile1, pile2, pile0]

    result = draw_table_pile_row(piles, 0)

    assert_equal(
        '            \033[30;47m 2 s \033[0m             \033[30;47m 2 s \033[0m      ',
        result)