Ejemplo n.º 1
0
 def test_saveCards(self):
     card1 = Card("Test", "test", ["cat1"])
     card2 = Card("Test2", "test2", ["cat2", "cat3"])
     self.storage.addCard(card1)
     self.storage.addCard(card2)
     self.storage.saveCards()
     assert self.fs.valueMap[
         "flashcards.json"] == '{"flashcards": [{"answer": "test", "categories": ["cat1"], "question": "Test"}, {"answer": "test2", "categories": ["cat2", "cat3"], "question": "Test2"}]}'
Ejemplo n.º 2
0
 def test_addCardsWithCategories(self):
     card1 = Card("Test", "test", ["cat1"])
     card2 = Card("Test2", "test2", ["cat2", "cat3"])
     self.storage.addCard(card1)
     self.storage.addCard(card2)
     assert len(self.storage.cards) == 2
     assert "cat1" in self.storage.cards[0].categories
     assert "cat2" in self.storage.cards[1].categories
     assert "cat3" in self.storage.cards[1].categories
     assert "cat1" not in self.storage.cards[1].categories
Ejemplo n.º 3
0
 def test_addCards(self):
     card1 = Card("Test", "test", [])
     card2 = Card("Test2", "test2", [])
     self.storage.addCard(card1)
     self.storage.addCard(card2)
     assert len(self.storage.cards) == 2
     assert self.storage.cards[0].question == "Test"
     assert self.storage.cards[0].answer == "test"
     assert self.storage.cards[1].question == "Test2"
     assert self.storage.cards[1].answer == "test2"
Ejemplo n.º 4
0
 def createItemCards(self):
     items = self.lol.getItems()
     for item in items:
         question = "What is {0}?".format(item.getName())
         answer = item.description()
         card = Card(question, answer, [self.ITEMS_CATEGORY])
         self.flashcards.addCard(card)
     return
Ejemplo n.º 5
0
 def createSummonerSpellCards(self):
     summonerSpells = self.lol.getSummonerSpells()
     for spell in summonerSpells:
         question = "What is the cooldown of {0}?".format(spell.getName())
         answer = spell.getCooldownString()
         card = Card(question, answer, [self.SUMMONER_SPELLS_CATEGORY])
         self.flashcards.addCard(card)
     return
Ejemplo n.º 6
0
 def createChampionAbilitiesCards(self):
     """Returns list of all champion ability cards"""
     championsList = self.lol.getChampions()
     for champ in championsList:
         abilities = champ.getAbilitiesAsHtml()
         question = "What are {0}'s abilities?".format(champ.getName())
         answer = "Passive: {0}<br><br>Q: {1}<br><br>W: {2}<br><br>E: {3}<br><br>R: {4}<br><br>".format(
             abilities[0], abilities[1], abilities[2], abilities[3],
             abilities[4])
         card = Card(question, answer, [self.CHAMPION_ABILITIES_CATEGORY])
         self.flashcards.addCard(card)
     return
Ejemplo n.º 7
0
 def createChampionAbilitiesCards(self):
     """Returns list of all champion ability cards"""
     championsList = self.lol.getChampions()
     for champ in championsList:
         print(champ.getName())
         detailedChamp = self.lol.getChampion(champ.jsonData["id"])
         abilities = detailedChamp.getAbilitiesAsStrings()
         question = "What are {0}'s abilities?".format(
             detailedChamp.getName())
         answer = r"Passive: {0}\n\nQ: {1}\n\nW: {2}\n\nE: {3}\n\nR: {4}\n".format(
             abilities[0], abilities[1], abilities[2], abilities[3],
             abilities[4])
         card = Card(question, answer, [self.CHAMPION_ABILITIES_CATEGORY])
         self.flashcards.addCard(card)
     return
Ejemplo n.º 8
0
 def test_addCard(self):
     card = Card("Test", "test", [])
     self.storage.addCard(card)
     assert len(self.storage.cards) == 1
     assert self.storage.cards[0].question == "Test"
     assert self.storage.cards[0].answer == "test"
Ejemplo n.º 9
0
def test_Card():
    c = Card("alleviate", "to make better, easier")
    assert c.question == "alleviate"
    assert c.answer == "to make better, easier"
Ejemplo n.º 10
0
def test_cheat():
    'Tests to see if cheat works'
    c= Card("abstract", "not specific, theoretical")
    assert c.question == "abstract"
    assert c.answer =="cheat"