-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate pytest-benchmark, add selector and full_game tests.
Closes #314
- Loading branch information
1 parent
25768de
commit aeed472
Showing
2 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from full_game import test_full_game | ||
from utils import * | ||
|
||
|
||
def run_selector(game, alex): | ||
selector = PIRATE | DRAGON + MINION | ||
assert len(selector.eval(game.player1.hand, game.player1)) >= 1 | ||
|
||
selector = IN_HAND + DRAGON + FRIENDLY | ||
targets = selector.eval(game, game.player1) | ||
assert len(targets) == 1 | ||
assert targets[0] == alex | ||
|
||
|
||
def test_selectors(benchmark): | ||
game = prepare_game() | ||
game.player1.discard_hand() | ||
alex = game.player1.give("EX1_561") | ||
|
||
benchmark(run_selector, game, alex) | ||
|
||
|
||
def test_fullgame(benchmark): | ||
random.seed(1857) | ||
benchmark(test_full_game) |