Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
tassaron committed Aug 11, 2023
1 parent 9bbece1 commit 365fe0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 2 additions & 4 deletions dnd_character/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,14 @@ def __init__(
self._class_levels = (
[] if class_index not in SRD_class_levels else SRD_class_levels[class_index]
)
self._level = 1 # may be increased later in this method
self._level = 1 # may be increased later in this method
self.prof_bonus = prof_bonus
self.ability_score_bonus = ability_score_bonus
self.class_features = class_features if class_features is not None else {}
self.class_features_enabled = (
class_features_enabled if class_features_enabled is not None else []
)
self._class_features_data = get_class_features_data(
character=self
)
self._class_features_data = get_class_features_data(character=self)

# Hit Dice and Hit Points: self.hd == 8 is a d8, 10 is a d10, etc
self.hd = 8 if hd is None else hd
Expand Down
12 changes: 9 additions & 3 deletions tests/test_class_features_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@ def test_reset_class_features_data_bard_level_1():
assert data["max_inspiration_count"] == 1
data["available_inspiration_count"] = 0
# at level 1 a short rest should NOT restore inspiration count
data = reset_class_features_data_counters(character=c, data=data, short_rest=True, long_rest=False)
data = reset_class_features_data_counters(
character=c, data=data, short_rest=True, long_rest=False
)
assert data["available_inspiration_count"] == 0
# a long rest should always restore inspiration count
data = reset_class_features_data_counters(character=c, data=data, short_rest=False, long_rest=True)
data = reset_class_features_data_counters(
character=c, data=data, short_rest=False, long_rest=True
)
assert data["available_inspiration_count"] == 1


Expand All @@ -79,7 +83,9 @@ def test_reset_class_features_data_bard_level_5():
assert data["max_inspiration_count"] == 1
data["available_inspiration_count"] = 0
# at level 5 a short rest should restore inspiration count
data = reset_class_features_data_counters(character=c, data=data, short_rest=True, long_rest=False)
data = reset_class_features_data_counters(
character=c, data=data, short_rest=True, long_rest=False
)
assert data["available_inspiration_count"] == 1


Expand Down

0 comments on commit 365fe0b

Please sign in to comment.