mirror of
https://github.com/Threnklyn/dungeon-sheets.git
synced 2026-05-25 07:08:29 +02:00
28 lines
758 B
Python
28 lines
758 B
Python
#!/usr/bin/env python
|
|
|
|
from unittest import TestCase
|
|
|
|
from dungeonsheets.character import Character
|
|
|
|
class TestCharacter(TestCase):
|
|
"""Tests for the generic character base class."""
|
|
|
|
def test_constructor(self):
|
|
char = Character(name="Inara")
|
|
|
|
def test_hit_dice(self):
|
|
# Test the getter
|
|
char = Character()
|
|
char.hit_dice_faces = 10
|
|
char.hit_dice_num = 2
|
|
self.assertEqual(char.hit_dice, '2d10')
|
|
# Test the setter
|
|
char.hit_dice = '3d12'
|
|
self.assertEqual(char.hit_dice_faces, 12)
|
|
self.assertEqual(char.hit_dice_num, 3)
|
|
|
|
def test_set_attrs(self):
|
|
char = Character()
|
|
char.set_attrs(name='Inara')
|
|
self.assertEqual(char.name, 'Inara')
|