Exemplo n.º 1
0
    def it_errors_when_lab_is_too_small():
        lab = Laboratory("apprentice lab")
        with pytest.raises(ValueError):
            lab.set_size(-6)

        lab.set_size(-5)
        with pytest.raises(ValueError):
            lab.decrease_size()
Exemplo n.º 2
0
 def it_can_change_usage():
     lab = Laboratory("apprentice lab")
     lab.change_usage("light")
     assert lab.usage == "light"
     lab.change_usage("heavy")
     assert lab.usage == "heavy"
     lab.change_usage("typical")
     assert lab.usage == "typical"
Exemplo n.º 3
0
 def it_initializes_with_default_values():
     lab = Laboratory(name="faerie garden")
     assert lab.name == "faerie garden"
     assert lab.owner == ""
     assert lab.size == 0
     assert lab.vp == 0
     assert lab.fp == 0
     assert lab.extra_upkeep == 0
     assert lab.usage == "typical"
     assert lab.points == 10
     assert lab.minor_fortifications == 0
     assert lab.major_fortifications == 0
Exemplo n.º 4
0
def demo_lab():
    lab = Laboratory(
        name="mountaintop 1",
        owner="Ipsum",
        size=1,
        virtue_points=3,
        flaw_points=2,
        extra_upkeep=1,
        usage="heavy",
        minor_fortifications=1,
        major_fortifications=2,
    )
    return lab
Exemplo n.º 5
0
 def it_correctly_calculates_annual_points():
     default_lab = Laboratory("apprentice lab")
     demo = demo_lab()
     assert default_lab.points == 10
     assert demo.points == 45.0
     default_lab.increase_size()
     assert default_lab.points == 15
     default_lab.add_extra_upkeep()
     assert default_lab.points == 30
Exemplo n.º 6
0
 def it_correctly_adds_major_fortifications():
     lab = Laboratory("apprentice lab")
     lab.add_major_fortification()
     assert lab.major_fortifications == 1
     lab.add_major_fortification(2)
     assert lab.major_fortifications == 3
Exemplo n.º 7
0
 def it_does_not_accept_atypical_usages():
     lab = Laboratory("apprentice lab")
     with pytest.raises(ValueError):
         lab.change_usage("weird")
Exemplo n.º 8
0
 def it_can_decrease_size():
     lab = Laboratory("apprentice lab")
     lab.decrease_size()
     assert lab.size == -1
     lab.decrease_size(2)
     assert lab.size == -3
Exemplo n.º 9
0
 def it_correctly_changes_name():
     lab = Laboratory("apprentice lab")
     lab.change_name("crater")
     assert lab.name == "crater"
Exemplo n.º 10
0
 def it_can_set_extra_upkeep():
     lab = Laboratory("apprentice lab")
     lab.set_extra_upkeep(5)
     assert lab.extra_upkeep == 5
Exemplo n.º 11
0
 def it_can_remove_flaw_points():
     lab = Laboratory("apprentice lab")
     lab.remove_flaw_points(1)
     assert lab.fp == -1
     lab.remove_flaw_points(3)
     assert lab.fp == -4
Exemplo n.º 12
0
 def it_can_add_flaw_points():
     lab = Laboratory("apprentice lab")
     lab.add_flaw_points()
     assert lab.fp == 1
     lab.add_flaw_points(5)
     assert lab.fp == 6
Exemplo n.º 13
0
 def it_can_remove_virtue_points():
     lab = Laboratory("apprentice lab")
     lab.remove_virtue_points()
     assert lab.vp == -1
     lab.remove_virtue_points(10)
     assert lab.vp == -11
Exemplo n.º 14
0
 def it_can_add_virtue_points():
     lab = Laboratory("apprentice lab")
     lab.add_virtue_points()
     assert lab.vp == 1
     lab.add_virtue_points(3)
     assert lab.vp == 4
Exemplo n.º 15
0
 def it_can_change_owner():
     lab = Laboratory("apprentice lab")
     lab.change_owner("Ipsum")
     assert lab.owner == "Ipsum"
Exemplo n.º 16
0
 def it_correctly_removes_major_fortifications():
     lab = Laboratory("test lab", major_fortifications=10)
     lab.remove_major_fortification()
     assert lab.major_fortifications == 9
     lab.remove_major_fortification(5)
     assert lab.major_fortifications == 4
Exemplo n.º 17
0
 def it_correctly_raises_errors_when_too_few_major_fortifications():
     lab = Laboratory("apprentice lab")
     with pytest.raises(ValueError):
         lab.remove_major_fortification()
Exemplo n.º 18
0
 def it_has_no_default_for_set_extra_upkeep():
     lab = Laboratory("apprentice lab")
     with pytest.raises(TypeError):
         lab.set_extra_upkeep()
Exemplo n.º 19
0
 def it_can_add_extra_upkeep():
     lab = Laboratory("apprentice lab")
     lab.add_extra_upkeep(1)
     assert lab.extra_upkeep == 1
     lab.add_extra_upkeep(4)
     assert lab.extra_upkeep == 5
Exemplo n.º 20
0
 def it_can_remove_extra_upkeep():
     lab = Laboratory("apprentice lab")
     lab.remove_extra_upkeep(1)
     assert lab.extra_upkeep == -1
     lab.remove_extra_upkeep(3)
     assert lab.extra_upkeep == -4
Exemplo n.º 21
0
 def it_can_set_size():
     lab = Laboratory("apprentice lab")
     for i in range(-5, 5):
         lab.set_size(i)
         assert lab.size == i
Exemplo n.º 22
0
 def it_can_increase_size():
     lab = Laboratory("apprentice lab")
     lab.increase_size()
     assert lab.size == 1
     lab.increase_size(3)
     assert lab.size == 4