<commit_before>from utils import *


def test_anubarak():
	game = prepare_empty_game()
	anubarak = game.player1.give("AT_036")
	anubarak.play()
	game.player1.discard_hand()
	assert len(game.player1.field) == 1
	assert len(game.player1.hand) == 0
	anubarak.destroy()
	assert len(game.player1.field) == 1
	assert len(game.player1.hand) == 1
	token = game.player1.field[0]
	assert token.id == "AT_<PASSWORD>t"
	anubarak = game.player1.hand[0]
	assert anubarak.id == "AT_036"
	game.end_turn(); game.end_turn()

	# Test for issue #283: play Anub'arak again
	anubarak.play()
	assert len(game.player1.field) == 2
	assert anubarak in game.player1.field
	assert token in game.player1.field
	assert len(game.player1.hand) == 0


def test_astral_communion():
	game = prepare_game(game_class=Game)
	game.player1.discard_hand()
	astral = game.player1.give("AT_043")
	game.player1.give(INNERVATE).play()
	game.player1.give(INNERVATE).play()
	for i in range(5):
		game.player1.give(WISP)
	assert game.player1.max_mana == 1
	assert game.player1.mana == 5
	astral.play()
	assert not game.player1.hand
	assert game.player1.mana == game.player1.max_mana == 10


def test_astral_communion_full_mana():
	game = prepare_game()
	assert game.player1.mana == 10
	astral = game.player1.give("AT_043")
	for i in range(5):
		game.player1.give(WISP)
	astral.play()
	assert len(game.player1.hand) == 1
	assert game.player1.hand[0].id == "CS2_013t"
	assert game.player1.max_mana == 10
	assert game.player1.mana == 6


def test_aviana():
	game = prepare_game()
	aviana = game.player1.give("AT_045")
	wisp1 = game.player1.give(WISP)
	assert wisp1.cost == 0
	deathwing = game.player1.give("NEW1_030")
	assert deathwing.cost == 10
	molten = game.player1.give("EX1_620")
	assert molten.cost == 25
	game.player1.give(MOONFIRE).play(game.player1.hero)
	assert molten.cost == 25 - 1
	aviana.play()
	for minion in (wisp1, deathwing, molten):
		assert minion.cost == 1
	wisp2 = game.player2.give(WISP)
	assert wisp2.cost == 0
	aviana.destroy()
	assert wisp1.cost == 0
	assert deathwing.cost == 10
	assert molten.cost == 25 - 1


def test_beneath_the_grounds():
	game = prepare_empty_game()
	game.player2.discard_hand()
	assert len(game.player2.deck) == 0
	grounds = game.player1.give("AT_035")
	grounds.play()
	assert len(game.player2.deck) == 3
	assert len(game.player2.hand) == 0
	game.end_turn()

	assert len(game.player2.hand) == 0
	assert len(game.player1.field) == 3
	for minion in game.player1.field:
		assert minion.id == "AT_036t"


def test_bolf_ramshield():
	game = prepare_game()
	bolf = game.player1.give("AT_124")
	bolf.play()
	game.player1.give(MOONFIRE).play(target=game.player1.hero)
	assert game.player1.hero.health == 30
	assert bolf.damage == 1
	game.player1.give(DAMAGE_5).play(target=game.player1.hero)
	assert game.player1.hero.health == 30
	assert bolf.damage == 1 + 5
	game.player1.give(DAMAGE_5).play(target=game.player1.hero)
	assert bolf.dead
	assert game.player1.hero.health == 30


def test_burgle():
	game = prepare_empty_game()
	burgle = game.player1.give("AT_033")
	burgle.play()
	assert len(game.player1.hand) == 2
	assert game.player1.hand[0].card_class == game.player2.hero.card_class
	assert game.player1.hand[0].type != CardType.HERO
	assert game.player1.hand[1].card_class == game.player2.hero.card_class
	assert game.player1.hand[1].type != CardType.HERO


def test_dark_bargain():
	game = prepare_game()
	for i in range(3):
		game.player2.summon(WISP)
	assert len(game.player2.field) == 3
	assert len(game.player1.hand) == 4
	bargain = game.player1.give("AT_025")
	bargain.play()
	assert len(game.player2.field) == 1
	assert len(game.player1.hand) == 2


def test_demonfuse():
	game = prepare_game()
	game.player2.max_mana = 9
	demonfuse = game.player1.give("AT_024")
	game.player2.summon(WISP)
	imp = game.player1.give(IMP)
	imp.play()
	game.player2.summon(IMP)<commit_msg>Add tests for Dalaran Aspirant<commit_after>from utils import *


def test_anubarak():
	game = prepare_empty_game()
	anubarak = game.player1.give("AT_036")
	anubarak.play()
	game.player1.discard_hand()
	assert len(game.player1.field) == 1
	assert len(game.player1.hand) == 0
	anubarak.destroy()
	assert len(game.player1.field) == 1
	assert len(game.player1.hand) == 1
	token = game.player1.field[0]
	assert token.id == "AT_<PASSWORD>"
	anubarak = game.player1.hand[0]
	assert anubarak.id == "AT_036"
	game.end_turn(); game.end_turn()

	# Test for issue #283: play Anub'arak again
	anubarak.play()
	assert len(game.player1.field) == 2
	assert anubarak in game.player1.field
	assert token in game.player1.field
	assert len(game.player1.hand) == 0


def test_astral_communion():
	game = prepare_game(game_class=Game)
	game.player1.discard_hand()
	astral = game.player1.give("AT_043")
	game.player1.give(INNERVATE).play()
	game.player1.give(INNERVATE).play()
	for i in range(5):
		game.player1.give(WISP)
	assert game.player1.max_mana == 1
	assert game.player1.mana == 5
	astral.play()
	assert not game.player1.hand
	assert game.player1.mana == game.player1.max_mana == 10


def test_astral_communion_full_mana():
	game = prepare_game()
	assert game.player1.mana == 10
	astral = game.player1.give("AT_043")
	for i in range(5):
		game.player1.give(WISP)
	astral.play()
	assert len(game.player1.hand) == 1
	assert game.player1.hand[0].id == "CS2_013t"
	assert game.player1.max_mana == 10
	assert game.player1.mana == 6


def test_aviana():
	game = prepare_game()
	aviana = game.player1.give("AT_045")
	wisp1 = game.player1.give(WISP)
	assert wisp1.cost == 0
	deathwing = game.player1.give("NEW1_030")
	assert deathwing.cost == 10
	molten = game.player1.give("EX1_620")
	assert molten.cost == 25
	game.player1.give(MOONFIRE).play(game.player1.hero)
	assert molten.cost == 25 - 1
	aviana.play()
	for minion in (wisp1, deathwing, molten):
		assert minion.cost == 1
	wisp2 = game.player2.give(WISP)
	assert wisp2.cost == 0
	aviana.destroy()
	assert wisp1.cost == 0
	assert deathwing.cost == 10
	assert molten.cost == 25 - 1


def test_beneath_the_grounds():
	game = prepare_empty_game()
	game.player2.discard_hand()
	assert len(game.player2.deck) == 0
	grounds = game.player1.give("AT_035")
	grounds.play()
	assert len(game.player2.deck) == 3
	assert len(game.player2.hand) == 0
	game.end_turn()

	assert len(game.player2.hand) == 0
	assert len(game.player1.field) == 3
	for minion in game.player1.field:
		assert minion.id == "AT_036t"


def test_bolf_ramshield():
	game = prepare_game()
	bolf = game.player1.give("AT_124")
	bolf.play()
	game.player1.give(MOONFIRE).play(target=game.player1.hero)
	assert game.player1.hero.health == 30
	assert bolf.damage == 1
	game.player1.give(DAMAGE_5).play(target=game.player1.hero)
	assert game.player1.hero.health == 30
	assert bolf.damage == 1 + 5
	game.player1.give(DAMAGE_5).play(target=game.player1.hero)
	assert bolf.dead
	assert game.player1.hero.health == 30


def test_burgle():
	game = prepare_empty_game()
	burgle = game.player1.give("AT_033")
	burgle.play()
	assert len(game.player1.hand) == 2
	assert game.player1.hand[0].card_class == game.player2.hero.card_class
	assert game.player1.hand[0].type != CardType.HERO
	assert game.player1.hand[1].card_class == game.player2.hero.card_class
	assert game.player1.hand[1].type != CardType.HERO


def test_dalaran_aspirant():
	game = prepare_game(ROGUE, ROGUE)
	aspirant = game.player1.give("AT_006")
	aspirant.play()
	assert aspirant.spellpower == game.player1.spellpower == 0
	game.player1.hero.power.use()
	assert aspirant.spellpower == game.player1.spellpower == 1
	game.end_turn(); game.end_turn()

	game.player1.hero.power.use()
	assert aspirant.spellpower == game.player1.spellpower == 2
	game.player1.give(MOONFIRE).play(target=game.player2.hero)
	assert game.player2.hero.health == 30 - 3
	game.end_turn()

	# Steal the aspirant (HearthSim/hs-bugs#412)
	game.player2.give(MIND_CONTROL).play(target=aspirant)
	assert game.player1.spellpower == 0
	assert aspirant.spellpower == game.player2.spellpower == 2
	game.player2.give(MOONFIRE).play(target=game.player1.hero)
	assert game.player1.hero.health == 30 - 3


def test_dark_bargain():
	game = prepare_game()
	for i in range(3):
		game.player2.summon(WISP)
	assert len(game.player2.field) == 3
	assert len(game.player1.hand) == 4
	bargain = game.player1.give("AT_025")
	bargain.play()
	assert len(game.player2.field) == 1
	assert len(game.player1.hand) == 2


def test_demonfuse():
	game = prepare_game()
	game.player2.max_mana = 9
	demonfuse = game.player1.give("AT_024")
	game.player2.summon(WISP)
	imp = game.player1.give(IMP)
	imp.play()
	game.player2.summon(IMP)
{'fraction_non_alphanumeric': 0.14546936873980898, 'fraction_numerical': 0.04821802935010482, 'mean_word_length': 4.653061224489796, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5478418', 'n_tokens_mistral': 3690, 'n_tokens_neox': 3389, 'n_words': 616}