diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | cardbase.py | 23 | ||||
-rwxr-xr-x | test_cardbase.py | 71 |
3 files changed, 88 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/cardbase.py b/cardbase.py index e69de29..f8c8796 100755 --- a/cardbase.py +++ b/cardbase.py @@ -0,0 +1,23 @@ +class Card(): + def __init__(self): + self.title = "" + self.cost = "" + self.colour = "" + self.type = "" + self.subtype = "" + self.edition = "" + self.art = "" + self.artist = "" + self.text = "" + self.flavour = "" + self.rarity = "" + self.number = "" + self.power = "" + self.toughness = "" + self.foil = "" + self.loyalty = "" + +def fetchCard(cardSet, cardNo): + card = Card() + card.title = "Shivan Dragon" + return card diff --git a/test_cardbase.py b/test_cardbase.py index e088f13..e3b0f32 100755 --- a/test_cardbase.py +++ b/test_cardbase.py @@ -2,20 +2,77 @@ import sys import unittest +import cardbase -class Test_testSomething(unittest.TestCase): +class Test_cardClass(unittest.TestCase): def setUp(self): - pass + self.card = cardbase.Card() + + # Tests + def test_cardHasTitle(self): + self.assertIsNotNone(self.card.title) + + def test_cardHasCost(self): + self.assertIsNotNone(self.card.cost) + + def test_cardHasColour(self): + self.assertIsNotNone(self.card.colour) + + def test_cardHasType(self): + self.assertIsNotNone(self.card.type) + + def test_cardHasSubType(self): + self.assertIsNotNone(self.card.subtype) + + def test_cardHasEdition(self): + self.assertIsNotNone(self.card.edition) + + def test_cardHasArt(self): + self.assertIsNotNone(self.card.art) - def tearDown(self): - pass + def test_cardHasArtist(self): + self.assertIsNotNone(self.card.artist) + + def test_cardHasText(self): + self.assertIsNotNone(self.card.text) + + def test_cardHasFlavour(self): + self.assertIsNotNone(self.card.flavour) - def test_something(self): - pass + def test_cardHasRarity(self): + self.assertIsNotNone(self.card.rarity) + + def test_cardHasNumber(self): + self.assertIsNotNone(self.card.number) + + def test_cardHasPower(self): + self.assertIsNotNone(self.card.power) + + def test_cardHasToughness(self): + self.assertIsNotNone(self.card.toughness) + + def test_cardHasFoil(self): + self.assertIsNotNone(self.card.foil) + + def test_cardHasLoyalty(self): + self.assertIsNotNone(self.card.loyalty) -def test(): +class Test_cardInformationIsFetched(unittest.TestCase): + + @classmethod + def setUpClass(cls): + # fetch shivan dragon info by the card's collector number (281 in M15) + cls.card = cardbase.fetchCard("m15", 281) + # Tests + def test_somethingIsFetched(self): + self.assertIsInstance(self.card, cardbase.Card) + + def test_correctTitleIsFetched(self): + self.assertEqual(self.card.title, "Shivan Dragon") + +def test(): unittest.main(exit=False) # The entry point |