-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcards_tests.py
71 lines (47 loc) · 1.69 KB
/
cards_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from behave import *
import cards
@Given('I have created a new deck object')
def step_impl(context):
pass
@When('I create the new class')
def step_impl(context):
new_deck = cards.Deck
assert new_deck is not None
context.card_holder = new_deck
assert context.new_deck.deck_of_cards.__len__() == 52
@Then('the card value should be recorded')
def step_impl(context):
assert context.card_holder.count == context.num_of_cards
@Given('I have a set number of cards')
def step_impl(context):
context.card_deck = cards.Deck
assert context.card_deck is not None
@When('I draw a card')
def step_impl(context):
context.num_of_cards = context.new_deck.deck_of_cards.__len__()
context.drawn_card = context.new_deck.get_card()
assert context.drawn_card is not None
@Then('it is removed from the deck')
def step_impl(context):
assert context.new_deck.deck_of_cards.__len__() < context.num_of_cards
assert context.drawn_card not in context.new_deck.deck_of_cards
@Given('I have a deck of cards')
def step_impl(context):
context.new_deck = cards.Deck
@When('I shuffle them')
def step_impl(context):
context.before_shuffle = context.new_deck
context.after_shuffle = context.new_deck.shuffle_deck()
@Then('The order has changed')
def step_impl(context):
assert context.before_shuffle != context.after_shuffle
@Given('I have a new deck of cards')
def step_impl(context):
context.new_deck = cards.Deck
@When('I create a hand')
def step_impl(context):
context.new_hand = cards.Hand(context.new_hand, 5)
assert context.new_hand is not None
@Then('my hand has 5 cards')
def step_impl(context):
assert context.new_hand.hand_of_cards.__len__() == 5