Skip to content

Commit a49b5b1

Browse files
committed
fixed some of the problems
1 parent 6bf667a commit a49b5b1

File tree

2 files changed

+38
-33
lines changed

2 files changed

+38
-33
lines changed

src/mercutio/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def customize(self, how='append', proficiencies=None, buffs=None):
177177
[self.religion_options.append(x['name']) for x in buffs if x['dimension'] == 'religion']
178178
[self.language_options.append(x['name']) for x in buffs if x['dimension'] == 'language']
179179
[self.background_options.append(x['name']) for x in buffs if x['dimension'] == 'background']
180-
self.buff_options.append(buffs)
180+
[self.buff_options.append(x) for x in buffs]
181181

182182

183183
def save(self, filename=None, csv=None):

tests/test_mercutio.py

+37-32
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
2-
import mercutio as mc
32

43
def test_gen():
4+
import mercutio as mc
55
player = mc.Player()
66
player.gen()
77

@@ -14,8 +14,9 @@ def test_gen():
1414
assert isinstance(player.attributes, (dict))
1515
assert isinstance(player.skills, (dict))
1616

17-
# test that overwriting player dimensions works as expected
17+
# test that appending to player dimensions works as expected
1818
def test_customize_append():
19+
import mercutio as mc
1920
player = mc.Player()
2021
class_len = len(player.player_class_options) # create a snapshot of the length of the list of class options
2122

@@ -30,30 +31,33 @@ def test_customize_append():
3031
assert len(player.player_class_options) == class_len + 3 # assert that this has increased the length of the class list by three
3132

3233
# 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()
3537

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+
]
4143

42-
# player.customize(how='overwrite', buffs=buffs)
44+
player.customize(how='overwrite', buffs=buffs)
4345

44-
# assert len(player.player_class_options) == 3
46+
assert len(player.player_class_options) == 3
4547

4648
# 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',)
5053

51-
# player.mod(name='beringor barthenon, guardian of bradley gardens')
54+
player.mod(name='beringor barthenon, guardian of bradley gardens')
5255

53-
# assert player.name == 'beringor barthenon, guardian of bradley gardens'
56+
assert player.name == 'beringor barthenon, guardian of bradley gardens'
5457

5558
# test that dice-rolls return values w/i expected ranges
5659
def test_dice():
60+
import mercutio as mc
5761
roll = mc.Roll() # instantiate the Roll() class
5862

5963
assert all([roll.four() for _ in range(100)]) in range(1,5)
@@ -62,22 +66,23 @@ def test_dice():
6266
assert all([roll.twelve() for _ in range(100)]) in range(1,13)
6367
assert all([roll.twenty() for _ in range(100)]) in range(1,21)
6468

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
8186

8287

8388

0 commit comments

Comments
 (0)