Example #1
0
def test_encounter(capsys):
    foe = game.mob("Troll", "Great Axe", 200, 30, 40)
    hero = game.mob("Hero", "Sword", 100, 35, 45)

    game.encounter(hero, foe)
    sys.stderr.write("a\n")

    # input1 = StringIO('a\n')
    # monkeypatch.setattr('sys.stdin', input1)
    out, err = capsys.readouterr()
    assert out == (
        f"{hero.name} encountered a {foe.name} wielding a {foe.weapon}")
Example #2
0
def test_class_mob_wep():
    ele = game.mob("Elf", "Bow", 150, 38, 48)
    assert ele.weapon == "Bow"
Example #3
0
def test_class_mob_name():
    ele = game.mob("Elf", "Bow", 150, 38, 48)
    assert ele.name == "Elf"
Example #4
0
def test_class_mob_ac():
    ele = game.mob("Elf", "Bow", 150, 38, 48)
    assert 38 <= ele.ac() < 48
Example #5
0
def test_class_mob_hp():
    ele = game.mob("Elf", "Bow", 150, 38, 48)
    assert ele.hp == 150