def test_character(): char = Character( name="TAKIS", feats=[Actor(), InspiringLeader()], items=[Item(Weight(60))], proficiencies=[Proficiency(Speed)] ) print() print(char)
def test_resources(resource): ch = Character(feats=[ Feat(Weight(60), Changer(score=5, resource=resource)), HeavyArmorMaster() ]) ch._initiative = 10 print('\n', ch.abilities[ABILITY.WIS], ch.initiative) print(ch.feats) for feat in ch.feats: for comp in feat.components: if isinstance(comp, Changer) and comp.resource is resource: if resource is Initiative: ch._initiative += comp.score assert ch.initiative == 15 print('\ncheck initiative') elif resource is ABILITY.WIS: ch.abilities[resource].score += comp.score assert ch.abilities[resource].score == 17 print('\ncheck ability score') else: assert False, 'check resource types' print('\n', ch.abilities[ABILITY.WIS], ch.initiative)
def test_weight_int(init, change): w = Weight(init) assert w.weight == Pound(init) w.weight = change assert w.weight == Pound(change)
def test_weight_pound_to_kilo(init, change): w = Weight(Pound(init)) assert w.weight == Pound(init) w.weight = Kilogram(change) assert w.weight == Kilogram(change)
def test_weight_kilo_to_pound(init, change): w = Weight(Kilogram(init)) assert w.weight == Kilogram(init) w.weight = Pound(change) assert w.weight == Pound(change)
def test_weight_kilogram(init, change): w = Weight(Kilogram(init)) assert w.weight == Kilogram(init) w.weight = Kilogram(change) assert w.weight == Kilogram(change)
def test_weight_pound(init, change): w = Weight(Pound(init)) assert w.weight == Pound(init) w.weight = Pound(change) assert w.weight == Pound(change)