Exemplo n.º 1
0
def test_move_with_non_top_ace_throws_error():
	game = Game(no_shuffle=True)
	game.deal()
	game.draw()
	game.draw()

	with assert_raises(ValueError):
		game.move_card('as')
Exemplo n.º 2
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]))
Exemplo n.º 3
0
def test_draw_flips_one_card_from_draw_pile_to_discard_pile():
	out = StringIO()
	game = Game(out=out, no_shuffle=True)
	game.deal()
	expected_draw_pile_size = len(game.piles[0]) - 1

	game.draw()

	assert_equal(expected_draw_pile_size, len(game.piles[0]))
	assert_equal(1, len(game.piles[1]))
	assert_true(game.piles[1][0].is_face_up())
Exemplo n.º 4
0
def test_draw_flips_one_card_from_draw_pile_to_discard_pile():
    out = StringIO()
    game = Game(out=out, no_shuffle=True)
    game.deal()
    expected_draw_pile_size = len(game.piles[0]) - 1

    game.draw()

    assert_equal(expected_draw_pile_size, len(game.piles[0]))
    assert_equal(1, len(game.piles[1]))
    assert_true(game.piles[1][0].is_face_up())