From 4c53f33470809ff9d35fe19e2c051f468f013952 Mon Sep 17 00:00:00 2001 From: Nanda Scott Date: Tue, 30 Jan 2018 10:18:47 -0500 Subject: [PATCH] Added more missed keys from scryfall. Created cards_unit_test. --- cards/scryfall_object.py | 48 ++++++++++++++++++++++++++++++++++++++++ tests/cards_unit_test.py | 7 ++++++ 2 files changed, 55 insertions(+) create mode 100644 tests/cards_unit_test.py diff --git a/cards/scryfall_object.py b/cards/scryfall_object.py index 52c7dcf..7148c42 100644 --- a/cards/scryfall_object.py +++ b/cards/scryfall_object.py @@ -341,3 +341,51 @@ class ScryfallObject(object): return KeyError("This card has no associated purchase uris key.") return self.scryfallJson['purchase_uris'] + + def life_modifier(self): + if self.__checkForKey('life_modifier') is None: + return KeyError("This card has no associated life modifier key.") + + return self.scryfallJson['life_modifier'] + + def hand_modifier(self): + if self.__checkForKey('hand_modifier') is None: + return KeyError("This card has no associated hand modifier key.") + + return self.scryfallJson['hand_modifier'] + + def color_indicator(self): + if self.__checkForKey('color_indicator') is None: + return KeyError("This card has no associated color indicator key.") + + return self.scryfallJson['color_indicator'] + + def all_parts(self): + if self.__checkForKey('all_parts') is None: + return KeyError("This card has no associated all parts key.") + + return self.scryfallJson['all_parts'] + + def card_faces(self): + if self.__checkForKey('card_faces') is None: + return KeyError("This card has no associated card faces key.") + + return self.scryfallJson['card_faces'] + + def watermark(self): + if self.__checkForKey('watermark') is None: + return KeyError("This card has no associated watermark key.") + + return self.scryfallJson['watermark'] + + def story_spotlight_number(self): + if self.__checkForKey('story_spotlight_number') is None: + return KeyError("This card has no associated story spotlight number key.") + + return self.scryfallJson['story_spotlight_number'] + + def story_spotlight_uri(self): + if self.__checkForKey('story_spotlight_uri') is None: + return KeyError("This card has no associated story spotlight uri key.") + + return self.scryfallJson['story_spotlight_uri'] diff --git a/tests/cards_unit_test.py b/tests/cards_unit_test.py new file mode 100644 index 0000000..94fef8a --- /dev/null +++ b/tests/cards_unit_test.py @@ -0,0 +1,7 @@ +import unittest +import cards + +class TestObjectCreation(unittest.TestCase): + + def testRandomCard(self): + pass