1
1
import pytest
2
- import mercutio as mc
3
2
4
3
def test_gen ():
4
+ import mercutio as mc
5
5
player = mc .Player ()
6
6
player .gen ()
7
7
@@ -14,8 +14,9 @@ def test_gen():
14
14
assert isinstance (player .attributes , (dict ))
15
15
assert isinstance (player .skills , (dict ))
16
16
17
- # test that overwriting player dimensions works as expected
17
+ # test that appending to player dimensions works as expected
18
18
def test_customize_append ():
19
+ import mercutio as mc
19
20
player = mc .Player ()
20
21
class_len = len (player .player_class_options ) # create a snapshot of the length of the list of class options
21
22
@@ -30,30 +31,33 @@ def test_customize_append():
30
31
assert len (player .player_class_options ) == class_len + 3 # assert that this has increased the length of the class list by three
31
32
32
33
# test that overwriting player dimensions works as expected
33
- # def test_customize_overwrite():
34
- # player = mc.Player()
34
+ def test_customize_overwrite ():
35
+ import mercutio as mc
36
+ player = mc .Player ()
35
37
36
- # buffs=[
37
- # { 'name':'wizard', 'dimension':'class'},
38
- # { 'name':'general', 'dimension':'class'},
39
- # { 'name':'edain','dimension':'class'},
40
- # ]
38
+ buffs = [
39
+ { 'name' :'wizard' , 'dimension' :'class' },
40
+ { 'name' :'general' , 'dimension' :'class' },
41
+ { 'name' :'edain' ,'dimension' :'class' },
42
+ ]
41
43
42
- # player.customize(how='overwrite', buffs=buffs)
44
+ player .customize (how = 'overwrite' , buffs = buffs )
43
45
44
- # assert len(player.player_class_options) == 3
46
+ assert len (player .player_class_options ) == 3
45
47
46
48
# test that modifications to player stats work as expected
47
- # def test_mod():
48
- # player = mc.Player()
49
- # player.gen(name='balthor batwing, earl of pentham',)
49
+ def test_mod ():
50
+ import mercutio as mc
51
+ player = mc .Player ()
52
+ player .gen (name = 'balthor batwing, earl of pentham' ,)
50
53
51
- # player.mod(name='beringor barthenon, guardian of bradley gardens')
54
+ player .mod (name = 'beringor barthenon, guardian of bradley gardens' )
52
55
53
- # assert player.name == 'beringor barthenon, guardian of bradley gardens'
56
+ assert player .name == 'beringor barthenon, guardian of bradley gardens'
54
57
55
58
# test that dice-rolls return values w/i expected ranges
56
59
def test_dice ():
60
+ import mercutio as mc
57
61
roll = mc .Roll () # instantiate the Roll() class
58
62
59
63
assert all ([roll .four () for _ in range (100 )]) in range (1 ,5 )
@@ -62,22 +66,23 @@ def test_dice():
62
66
assert all ([roll .twelve () for _ in range (100 )]) in range (1 ,13 )
63
67
assert all ([roll .twenty () for _ in range (100 )]) in range (1 ,21 )
64
68
65
- # def test_buffs():
66
- # player = mc.Player()
67
- # player.gen(
68
- # player_class='fighter',
69
- # name='balthor batwing, earl of pentham',
70
- # religion='paladine',
71
- # race='human',
72
- # language='common',
73
- # background='sage'
74
- # )
75
- # attribute_check = player.attributes['strength'] # create a snapshot of the player's attributes
76
-
77
- # player.background = 'soldier' # now manually change the player background to soldier
78
- # player.buff(name='soldier', dimension='background') # then we buff the character
79
-
80
- # assert player.attributes['strength'] == attribute_check + 1 # and check that the buff successfully passed
69
+ def test_buffs ():
70
+ import mercutio as mc
71
+ player = mc .Player ()
72
+ player .gen (
73
+ player_class = 'fighter' ,
74
+ name = 'balthor batwing, earl of pentham' ,
75
+ religion = 'paladine' ,
76
+ race = 'human' ,
77
+ language = 'common' ,
78
+ background = 'sage'
79
+ )
80
+ attribute_check = player .attributes ['strength' ] # create a snapshot of the player's attributes
81
+
82
+ player .background = 'soldier' # now manually change the player background to soldier
83
+ player .buff (name = 'soldier' , dimension = 'background' ) # then we buff the character
84
+
85
+ assert player .attributes ['strength' ] == attribute_check + 1 # and check that the buff successfully passed
81
86
82
87
83
88
0 commit comments