diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 113c822..dd11700 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,23 +4,22 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8] + python-version: [3.6, 3.7, 3.8, 3.9] steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Test with pytest - run: | - pytest + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Test with pytest + run: | + pytest diff --git a/docs/scrython.cards/ArenaId.md b/docs/scrython.cards/ArenaId.md index 507036e..e4abd79 100644 --- a/docs/scrython.cards/ArenaId.md +++ b/docs/scrython.cards/ArenaId.md @@ -151,6 +151,17 @@ The rank of the card on edhrec.com Returns: int: The rank of the card on edhrec.co +``` +--- +### `finishes()` + +``` +A list of computer-readable flags that indicate if this card + can come in foil, nonfoil, etched, or glossy finishes. + + Returns: + list: A list of all finishes. + ``` --- ### `flavor_text()` @@ -166,8 +177,10 @@ The flavor text of the card, if any ### `foil()` ``` -True if this printing exists in a foil version - +True if this printing exists in a foil version. + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. + Returns: boolean @@ -387,6 +400,8 @@ The oracle name of the card ``` True if this printing does not exist in foil + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. Returns: boolean @@ -463,7 +478,7 @@ Preview information for this card, if any. ### `prices()` ``` -Returns prices from modes `usd`, `usd_foil`, `eur`, and `tix` +Returns prices from modes `usd`, `usd_foil`, `usd_etched`, `usd_glossy`, `eur`, and `tix` Args: mode (string): The prices to get @@ -665,6 +680,16 @@ True if this card is featured in the story Returns: boolean +``` +--- +### `tcgplayer_etched_id()` + +``` +The `etched_id` of the card on TCGplayer. + + Returns: + integer: The TCGplayer etched id of the card + ``` --- ### `tcgplayer_id()` diff --git a/docs/scrython.cards/Collector.md b/docs/scrython.cards/Collector.md index ef7ef7c..1df4b27 100644 --- a/docs/scrython.cards/Collector.md +++ b/docs/scrython.cards/Collector.md @@ -148,6 +148,17 @@ The rank of the card on edhrec.com Returns: int: The rank of the card on edhrec.co +``` +--- +### `finishes()` + +``` +A list of computer-readable flags that indicate if this card + can come in foil, nonfoil, etched, or glossy finishes. + + Returns: + list: A list of all finishes. + ``` --- ### `flavor_text()` @@ -163,8 +174,10 @@ The flavor text of the card, if any ### `foil()` ``` -True if this printing exists in a foil version - +True if this printing exists in a foil version. + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. + Returns: boolean @@ -384,6 +397,8 @@ The oracle name of the card ``` True if this printing does not exist in foil + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. Returns: boolean @@ -460,7 +475,7 @@ Preview information for this card, if any. ### `prices()` ``` -Returns prices from modes `usd`, `usd_foil`, `eur`, and `tix` +Returns prices from modes `usd`, `usd_foil`, `usd_etched`, `usd_glossy`, `eur`, and `tix` Args: mode (string): The prices to get @@ -662,6 +677,16 @@ True if this card is featured in the story Returns: boolean +``` +--- +### `tcgplayer_etched_id()` + +``` +The `etched_id` of the card on TCGplayer. + + Returns: + integer: The TCGplayer etched id of the card + ``` --- ### `tcgplayer_id()` diff --git a/docs/scrython.cards/Id.md b/docs/scrython.cards/Id.md index ca1991e..ef12b6e 100644 --- a/docs/scrython.cards/Id.md +++ b/docs/scrython.cards/Id.md @@ -151,6 +151,17 @@ The rank of the card on edhrec.com Returns: int: The rank of the card on edhrec.co +``` +--- +### `finishes()` + +``` +A list of computer-readable flags that indicate if this card + can come in foil, nonfoil, etched, or glossy finishes. + + Returns: + list: A list of all finishes. + ``` --- ### `flavor_text()` @@ -166,8 +177,10 @@ The flavor text of the card, if any ### `foil()` ``` -True if this printing exists in a foil version - +True if this printing exists in a foil version. + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. + Returns: boolean @@ -387,6 +400,8 @@ The oracle name of the card ``` True if this printing does not exist in foil + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. Returns: boolean @@ -463,7 +478,7 @@ Preview information for this card, if any. ### `prices()` ``` -Returns prices from modes `usd`, `usd_foil`, `eur`, and `tix` +Returns prices from modes `usd`, `usd_foil`, `usd_etched`, `usd_glossy`, `eur`, and `tix` Args: mode (string): The prices to get @@ -665,6 +680,16 @@ True if this card is featured in the story Returns: boolean +``` +--- +### `tcgplayer_etched_id()` + +``` +The `etched_id` of the card on TCGplayer. + + Returns: + integer: The TCGplayer etched id of the card + ``` --- ### `tcgplayer_id()` diff --git a/docs/scrython.cards/Mtgo.md b/docs/scrython.cards/Mtgo.md index 64b03f0..a591937 100644 --- a/docs/scrython.cards/Mtgo.md +++ b/docs/scrython.cards/Mtgo.md @@ -151,6 +151,17 @@ The rank of the card on edhrec.com Returns: int: The rank of the card on edhrec.co +``` +--- +### `finishes()` + +``` +A list of computer-readable flags that indicate if this card + can come in foil, nonfoil, etched, or glossy finishes. + + Returns: + list: A list of all finishes. + ``` --- ### `flavor_text()` @@ -166,8 +177,10 @@ The flavor text of the card, if any ### `foil()` ``` -True if this printing exists in a foil version - +True if this printing exists in a foil version. + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. + Returns: boolean @@ -387,6 +400,8 @@ The oracle name of the card ``` True if this printing does not exist in foil + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. Returns: boolean @@ -463,7 +478,7 @@ Preview information for this card, if any. ### `prices()` ``` -Returns prices from modes `usd`, `usd_foil`, `eur`, and `tix` +Returns prices from modes `usd`, `usd_foil`, `usd_etched`, `usd_glossy`, `eur`, and `tix` Args: mode (string): The prices to get @@ -665,6 +680,16 @@ True if this card is featured in the story Returns: boolean +``` +--- +### `tcgplayer_etched_id()` + +``` +The `etched_id` of the card on TCGplayer. + + Returns: + integer: The TCGplayer etched id of the card + ``` --- ### `tcgplayer_id()` diff --git a/docs/scrython.cards/Multiverse.md b/docs/scrython.cards/Multiverse.md index 3e0f747..fdf03e4 100644 --- a/docs/scrython.cards/Multiverse.md +++ b/docs/scrython.cards/Multiverse.md @@ -151,6 +151,17 @@ The rank of the card on edhrec.com Returns: int: The rank of the card on edhrec.co +``` +--- +### `finishes()` + +``` +A list of computer-readable flags that indicate if this card + can come in foil, nonfoil, etched, or glossy finishes. + + Returns: + list: A list of all finishes. + ``` --- ### `flavor_text()` @@ -166,8 +177,10 @@ The flavor text of the card, if any ### `foil()` ``` -True if this printing exists in a foil version - +True if this printing exists in a foil version. + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. + Returns: boolean @@ -387,6 +400,8 @@ The oracle name of the card ``` True if this printing does not exist in foil + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. Returns: boolean @@ -463,7 +478,7 @@ Preview information for this card, if any. ### `prices()` ``` -Returns prices from modes `usd`, `usd_foil`, `eur`, and `tix` +Returns prices from modes `usd`, `usd_foil`, `usd_etched`, `usd_glossy`, `eur`, and `tix` Args: mode (string): The prices to get @@ -665,6 +680,16 @@ True if this card is featured in the story Returns: boolean +``` +--- +### `tcgplayer_etched_id()` + +``` +The `etched_id` of the card on TCGplayer. + + Returns: + integer: The TCGplayer etched id of the card + ``` --- ### `tcgplayer_id()` diff --git a/docs/scrython.cards/Named.md b/docs/scrython.cards/Named.md index 5c9d123..8b0b78d 100644 --- a/docs/scrython.cards/Named.md +++ b/docs/scrython.cards/Named.md @@ -153,6 +153,17 @@ The rank of the card on edhrec.com Returns: int: The rank of the card on edhrec.co +``` +--- +### `finishes()` + +``` +A list of computer-readable flags that indicate if this card + can come in foil, nonfoil, etched, or glossy finishes. + + Returns: + list: A list of all finishes. + ``` --- ### `flavor_text()` @@ -168,8 +179,10 @@ The flavor text of the card, if any ### `foil()` ``` -True if this printing exists in a foil version - +True if this printing exists in a foil version. + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. + Returns: boolean @@ -389,6 +402,8 @@ The oracle name of the card ``` True if this printing does not exist in foil + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. Returns: boolean @@ -465,7 +480,7 @@ Preview information for this card, if any. ### `prices()` ``` -Returns prices from modes `usd`, `usd_foil`, `eur`, and `tix` +Returns prices from modes `usd`, `usd_foil`, `usd_etched`, `usd_glossy`, `eur`, and `tix` Args: mode (string): The prices to get @@ -667,6 +682,16 @@ True if this card is featured in the story Returns: boolean +``` +--- +### `tcgplayer_etched_id()` + +``` +The `etched_id` of the card on TCGplayer. + + Returns: + integer: The TCGplayer etched id of the card + ``` --- ### `tcgplayer_id()` diff --git a/docs/scrython.cards/Random.md b/docs/scrython.cards/Random.md index 8f8808d..5512530 100644 --- a/docs/scrython.cards/Random.md +++ b/docs/scrython.cards/Random.md @@ -149,6 +149,17 @@ The rank of the card on edhrec.com Returns: int: The rank of the card on edhrec.co +``` +--- +### `finishes()` + +``` +A list of computer-readable flags that indicate if this card + can come in foil, nonfoil, etched, or glossy finishes. + + Returns: + list: A list of all finishes. + ``` --- ### `flavor_text()` @@ -164,8 +175,10 @@ The flavor text of the card, if any ### `foil()` ``` -True if this printing exists in a foil version - +True if this printing exists in a foil version. + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. + Returns: boolean @@ -385,6 +398,8 @@ The oracle name of the card ``` True if this printing does not exist in foil + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. Returns: boolean @@ -461,7 +476,7 @@ Preview information for this card, if any. ### `prices()` ``` -Returns prices from modes `usd`, `usd_foil`, `eur`, and `tix` +Returns prices from modes `usd`, `usd_foil`, `usd_etched`, `usd_glossy`, `eur`, and `tix` Args: mode (string): The prices to get @@ -663,6 +678,16 @@ True if this card is featured in the story Returns: boolean +``` +--- +### `tcgplayer_etched_id()` + +``` +The `etched_id` of the card on TCGplayer. + + Returns: + integer: The TCGplayer etched id of the card + ``` --- ### `tcgplayer_id()` diff --git a/requirements.txt b/requirements.txt index d16da0f..9966432 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -aiohttp==3.6.1 +aiohttp==3.7.4 asyncio==3.4.3 diff --git a/scrython/cards/cards_object.py b/scrython/cards/cards_object.py index 6451ec2..ffd3baa 100644 --- a/scrython/cards/cards_object.py +++ b/scrython/cards/cards_object.py @@ -91,6 +91,16 @@ class CardsObject(FoundationObject): return self.scryfallJson['tcgplayer_id'] + def tcgplayer_etched_id(self): + """The `etched_id` of the card on TCGplayer. + + Returns: + integer: The TCGplayer etched id of the card + """ + super(CardsObject, self)._checkForKey('tcgplayer_etched_id') + + return self.scryfallJson['tcgplayer_etched_id'] + def name(self): """The oracle name of the card @@ -167,6 +177,7 @@ class CardsObject(FoundationObject): 'meld': lambda num: self.scryfallJson['image_uris'], 'leveler': lambda num: self.scryfallJson['image_uris'], 'saga': lambda num: self.scryfallJson['image_uris'], + 'class': lambda num: self.scryfallJson['image_uris'], 'planar': lambda num: self.scryfallJson['image_uris'], 'scheme': lambda num: self.scryfallJson['image_uris'], 'vanguard': lambda num: self.scryfallJson['image_uris'], @@ -462,7 +473,7 @@ class CardsObject(FoundationObject): return self.scryfallJson['edhrec_rank'] def prices(self, mode): - """Returns prices from modes `usd`, `usd_foil`, `eur`, and `tix` + """Returns prices from modes `usd`, `usd_foil`, `usd_etched`, `usd_glossy`, `eur`, and `tix` Args: mode (string): The prices to get @@ -473,7 +484,7 @@ class CardsObject(FoundationObject): Returns: float: The prices as a float """ - modes = ['usd', 'usd_foil', 'eur', 'tix'] + modes = ['usd', 'usd_foil', 'usd_etched', 'usd_glossy', 'eur', 'tix'] if mode not in modes: raise KeyError("{} is not a key.".format(mode)) @@ -672,23 +683,31 @@ class CardsObject(FoundationObject): return self.scryfallJson['oracle_id'] def foil(self): - """True if this printing exists in a foil version - + """True if this printing exists in a foil version. + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. + Returns: boolean """ super(CardsObject, self)._checkForKey('foil') + print('WARNING: This method will be deprecated on Nov 1, 2021. Please use the `finishes` method instead.') + return self.scryfallJson['foil'] def nonfoil(self): """True if this printing does not exist in foil + + DEPRECATION NOTICE: This method will be deprecated on Nov 1, 2021. Returns: boolean """ super(CardsObject, self)._checkForKey('nonfoil') + print('WARNING: This method will be deprecated on Nov 1, 2021. Please use the `finishes` method instead.') + return self.scryfallJson['nonfoil'] def oversized(self): @@ -758,4 +777,15 @@ class CardsObject(FoundationObject): """ super(CardsObject, self)._checkForKey('image_status') - return self.scryfallJson['image_status'] \ No newline at end of file + return self.scryfallJson['image_status'] + + def finishes(self): + """A list of computer-readable flags that indicate if this card + can come in foil, nonfoil, etched, or glossy finishes. + + Returns: + list: A list of all finishes. + """ + super(CardsObject, self)._checkForKey('finishes') + + return self.scryfallJson['finishes'] \ No newline at end of file diff --git a/unittests/test_cards.py b/unittests/test_cards.py index 1e685e8..c78f9af 100644 --- a/unittests/test_cards.py +++ b/unittests/test_cards.py @@ -18,6 +18,8 @@ vanguard = Id(id='87c1234b-3834-4bba-bef2-05707bb1e8e2'); time.sleep(0.1) alt_lang_card = Collector(code='ths', collector_number='75', lang='ja'); time.sleep(0.1) planeswalker = Id(id='4c565076-5db2-47ea-8ee0-4a4fd7bb353d'); time.sleep(0.1) preview_check = Id(id='fb6b12e7-bb93-4eb6-bad1-b256a6ccff4e'); time.sleep(0.1) +meld_card = Id(id='5a7a212e-e0b6-4f12-a95c-173cae023f93'); time.sleep(0.1) +foil_etched = Id(id='47f44d5a-f3d6-4a9a-8bd3-b17a88565c51'); time.sleep(0.1) autocomplete = Autocomplete(q='Thal'); time.sleep(0.1) @@ -158,7 +160,7 @@ class TestCardObjects(unittest.TestCase): self.assertIsInstance(transform.color_indicator(1), list) def test_all_parts(self): - self.assertIsInstance(transform.all_parts(), list) + self.assertIsInstance(meld_card.all_parts(), list) def non_online_card_faces(self): self.assertIsInstance(transform.card_faces(), list) @@ -196,15 +198,9 @@ class TestCardObjects(unittest.TestCase): def test_oracle_id(self): self.assertIsInstance(non_online_card.oracle_id(), str) - def test_foil(self): - self.assertIsInstance(non_online_card.foil(), bool) - def test_loyalty(self): self.assertIsInstance(planeswalker.loyalty(), str) - def test_non_foil(self): - self.assertIsInstance(non_online_card.nonfoil(), bool) - def test_oversized(self): self.assertIsInstance(non_online_card.oversized(), bool) @@ -215,6 +211,27 @@ class TestCardObjects(unittest.TestCase): def test_image_status(self): self.assertIsInstance(non_online_card.image_status(), str) + def test_finishes(self): + self.assertIsInstance(foil_etched.finishes(), list) + + def test_tcgplayer_id(self): + self.assertIsInstance(non_online_card.tcgplayer_id(), int) + + def test_tcgplayer_etched_id(self): + self.assertIsInstance(foil_etched.tcgplayer_etched_id(), int) + + def test_frame_effects(self): + self.assertIsInstance(frame_effected_card.frame_effects(), list) + + def test_games(self): + self.assertIsInstance(non_online_card.games(), list) + + def test_promo(self): + self.assertIsInstance(non_online_card.promo(), bool) + + def test_released_at(self): + self.assertIsInstance(non_online_card.released_at(), str) + class TestAutocomplete(unittest.TestCase): def test_object(self): @@ -246,21 +263,6 @@ class TestSearch(unittest.TestCase): def test_data_length(self): self.assertIsInstance(search.data_length(), int) - def test_tcgplayer_id(self): - self.assertIsInstance(non_online_card.tcgplayer_id(), int) - - def test_frame_effects(self): - self.assertIsInstance(frame_effected_card.frame_effects(), list) - - def test_games(self): - self.assertIsInstance(non_online_card.games(), list) - - def test_promo(self): - self.assertIsInstance(non_online_card.promo(), bool) - - def test_released_at(self): - self.assertIsInstance(non_online_card.released_at(), str) - if __name__ == '__main__': test_classes_to_run = [