From 5fd864718f4cd9e1e67835063a1efc24dd85e0c4 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Mon, 1 Jun 2015 12:36:28 +0200 Subject: Moved some things around, separated parsing into a different module to make way for the GUI --- test_shoal.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'test_shoal.py') diff --git a/test_shoal.py b/test_shoal.py index 610ce4b..8359bce 100755 --- a/test_shoal.py +++ b/test_shoal.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 + def setUpClass(cls): with open("testcards/shoal", "r") as file: cls.page = html.fromstring(file.read()) # Tests def test_correctTitleIsParsed(self): - self.assertEqual(cardbase.getTitle(self.page), "Disrupting Shoal") + self.assertEqual(cardparser.getTitle(self.page), "Disrupting Shoal") def test_correctCostIsParsed(self): - self.assertEqual(cardbase.getCost(self.page), "XUU") + self.assertEqual(cardparser.getCost(self.page), "XUU") + + def test_correctConvertedCostIsParsed(self): + self.assertEqual(cardparser.getConvertedCost(self.page), "2") def test_correctColourIsParsed(self): - self.assertEqual(cardbase.getColour(self.page), "U") + self.assertEqual(cardparser.getColour(self.page), "U") def test_correctTypeIsParsed(self): - self.assertEqual(cardbase.getType(self.page), "Instant") + self.assertEqual(cardparser.getType(self.page), "Instant") def test_correctSubTypeIsParsed(self): - self.assertEqual(cardbase.getSubType(self.page), "Arcane") + self.assertEqual(cardparser.getSubType(self.page), "Arcane") def test_correctArtistIsParsed(self): - self.assertEqual(cardbase.getArtist(self.page), "Scott M. Fischer") + self.assertEqual(cardparser.getArtist(self.page), "Scott M. Fischer") def test_correctTextIsParsed(self): - self.assertEqual(cardbase.getText(self.page), ["You may exile a blue card with converted mana cost X from your hand rather than pay Disrupting Shoal's mana cost.", "Counter target spell if its converted mana cost is X."]) + self.assertEqual(cardparser.getText(self.page), ["You may exile a blue card with converted mana cost X from your hand rather than pay Disrupting Shoal's mana cost.", "Counter target spell if its converted mana cost is X."]) def test_correctFlavourIsParsed(self): - self.assertEqual(cardbase.getFlavour(self.page), "") + self.assertEqual(cardparser.getFlavour(self.page), "") def test_correctRarityIsParsed(self): - self.assertEqual(cardbase.getRarity(self.page), "Rare") + self.assertEqual(cardparser.getRarity(self.page), "Rare") def test_correctPowerIsParsed(self): - self.assertEqual(cardbase.getPower(self.page), "") + self.assertEqual(cardparser.getPower(self.page), "") def test_correctToughnessIsParsed(self): - self.assertEqual(cardbase.getToughness(self.page), "") + self.assertEqual(cardparser.getToughness(self.page), "") 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("bok", "33") + cls.card = cardparser.fetchCard("bok", "33") def test_cardHasCorrectEdition(self): self.assertEqual(self.card.edition, "bok") -- cgit v1.2.3