def test_add_ability(self): card = Card() assert card.add_ability("attack", "Facepalm") assert "Facepalm" in card.get_abilities("attack") assert card.add_ability("attack", "Slap") assert "Slap" in card.get_abilities("attack")
def test_save_load(self): original = Card(1, "Test") original.add_ability("attack", "Slap") original.add_attribute("test") original.set_info("art", 1) savedict = original.save() loaded = Card(loaddict=savedict) assert loaded.code == original.code assert loaded.name == original.name assert loaded.abilities == original.abilities assert loaded.attributes == original.attributes assert loaded.info == original.info
def test_something(self): import yaml with open("test.crd") as test: loaded = yaml.safe_load(test) from librarian.card import Card card = Card(name="card") card.add_attribute("alive") card.add_ability("open", "attack") card.set_info("art", "") expected = card.save() self.assertEqual(loaded, expected)
def test_get_abilities(self): card = Card() card.add_ability("attack", "Facepalm") assert card.get_abilities("block") is None assert card.get_abilities("attack") == ["Facepalm"]