aboutsummaryrefslogtreecommitdiffstats
path: root/test_hydra.py
diff options
context:
space:
mode:
Diffstat (limited to 'test_hydra.py')
-rwxr-xr-xtest_hydra.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/test_hydra.py b/test_hydra.py
index 1fbaa9f..4853715 100755
--- a/test_hydra.py
+++ b/test_hydra.py
@@ -1,61 +1,61 @@
#!/usr/bin/env python3
-import sys
import unittest
-import cardbase
from lxml import html
-
+import cardparser
class Test_cardInformationParsing(unittest.TestCase):
@classmethod
def setUpClass(cls):
- # but actually, use the pre-fetched file to avoid querying the server too much
with open("testcards/hydra", "r") as file:
cls.page = html.fromstring(file.read())
# Tests
def test_correctTitleIsParsed(self):
- self.assertEqual(cardbase.getTitle(self.page), "Khalni Hydra")
+ self.assertEqual(cardparser.getTitle(self.page), "Khalni Hydra")
def test_correctCostIsParsed(self):
- self.assertEqual(cardbase.getCost(self.page), "GGGGGGGG")
+ self.assertEqual(cardparser.getCost(self.page), "GGGGGGGG")
+
+ def test_correctConvertedCostIsParsed(self):
+ self.assertEqual(cardparser.getConvertedCost(self.page), "8")
def test_correctColourIsParsed(self):
- self.assertEqual(cardbase.getColour(self.page), "G")
+ self.assertEqual(cardparser.getColour(self.page), "G")
def test_correctTypeIsParsed(self):
- self.assertEqual(cardbase.getType(self.page), "Creature")
+ self.assertEqual(cardparser.getType(self.page), "Creature")
def test_correctSubTypeIsParsed(self):
- self.assertEqual(cardbase.getSubType(self.page), "Hydra")
+ self.assertEqual(cardparser.getSubType(self.page), "Hydra")
def test_correctArtistIsParsed(self):
- self.assertEqual(cardbase.getArtist(self.page), "Todd Lockwood")
+ self.assertEqual(cardparser.getArtist(self.page), "Todd Lockwood")
def test_correctTextIsParsed(self):
- self.assertEqual(cardbase.getText(self.page), ["Khalni Hydra costs {G} less to cast for each green creature you control.", "Trample"])
+ self.assertEqual(cardparser.getText(self.page), ["Khalni Hydra costs {G} less to cast for each green creature you control.", "Trample"])
def test_correctFlavourIsParsed(self):
- self.assertEqual(cardbase.getFlavour(self.page), "\"In ages past, bargains were struck and promises were made. Now we must collect on our debt. Begin the hymns.\" —Moruul, Khalni druid")
+ self.assertEqual(cardparser.getFlavour(self.page), "\"In ages past, bargains were struck and promises were made. Now we must collect on our debt. Begin the hymns.\" —Moruul, Khalni druid")
def test_correctRarityIsParsed(self):
- self.assertEqual(cardbase.getRarity(self.page), "Mythic Rare")
+ self.assertEqual(cardparser.getRarity(self.page), "Mythic Rare")
def test_correctPowerIsParsed(self):
- self.assertEqual(cardbase.getPower(self.page), "8")
+ self.assertEqual(cardparser.getPower(self.page), "8")
def test_correctToughnessIsParsed(self):
- self.assertEqual(cardbase.getToughness(self.page), "8")
+ self.assertEqual(cardparser.getToughness(self.page), "8")
def test_correctLoyaltyIsParsed(self):
- self.assertEqual(cardbase.getLoyalty(self.page), "")
+ self.assertEqual(cardparser.getLoyalty(self.page), "")
class Test_additionalCardData(unittest.TestCase):
@classmethod
def setUpClass(cls):
- cls.card = cardbase.fetchCard("roe", "192")
+ cls.card = cardparser.fetchCard("roe", "192")
def test_cardHasCorrectEdition(self):
self.assertEqual(self.card.edition, "roe")