Added preview key
This commit is contained in:
parent
6f93d8f985
commit
9f1d1bcf7d
|
@ -432,6 +432,22 @@ The power of the creature, if applicable
|
|||
Returns:
|
||||
string
|
||||
|
||||
```
|
||||
---
|
||||
### `preview()`
|
||||
|
||||
```
|
||||
Preview information for this card, if any.
|
||||
You may pass the name of a valid key to return the value of that key.
|
||||
Such as a source_uri.
|
||||
|
||||
Args:
|
||||
key (string): A key for specific information about the preview.
|
||||
|
||||
Returns:
|
||||
dict: If provided no key, the entire dict is returned.
|
||||
string: If provided a key, the value of that key is returned.
|
||||
|
||||
```
|
||||
---
|
||||
### `prices()`
|
||||
|
|
|
@ -429,6 +429,22 @@ The power of the creature, if applicable
|
|||
Returns:
|
||||
string
|
||||
|
||||
```
|
||||
---
|
||||
### `preview()`
|
||||
|
||||
```
|
||||
Preview information for this card, if any.
|
||||
You may pass the name of a valid key to return the value of that key.
|
||||
Such as a source_uri.
|
||||
|
||||
Args:
|
||||
key (string): A key for specific information about the preview.
|
||||
|
||||
Returns:
|
||||
dict: If provided no key, the entire dict is returned.
|
||||
string: If provided a key, the value of that key is returned.
|
||||
|
||||
```
|
||||
---
|
||||
### `prices()`
|
||||
|
|
|
@ -432,6 +432,22 @@ The power of the creature, if applicable
|
|||
Returns:
|
||||
string
|
||||
|
||||
```
|
||||
---
|
||||
### `preview()`
|
||||
|
||||
```
|
||||
Preview information for this card, if any.
|
||||
You may pass the name of a valid key to return the value of that key.
|
||||
Such as a source_uri.
|
||||
|
||||
Args:
|
||||
key (string): A key for specific information about the preview.
|
||||
|
||||
Returns:
|
||||
dict: If provided no key, the entire dict is returned.
|
||||
string: If provided a key, the value of that key is returned.
|
||||
|
||||
```
|
||||
---
|
||||
### `prices()`
|
||||
|
|
|
@ -432,6 +432,22 @@ The power of the creature, if applicable
|
|||
Returns:
|
||||
string
|
||||
|
||||
```
|
||||
---
|
||||
### `preview()`
|
||||
|
||||
```
|
||||
Preview information for this card, if any.
|
||||
You may pass the name of a valid key to return the value of that key.
|
||||
Such as a source_uri.
|
||||
|
||||
Args:
|
||||
key (string): A key for specific information about the preview.
|
||||
|
||||
Returns:
|
||||
dict: If provided no key, the entire dict is returned.
|
||||
string: If provided a key, the value of that key is returned.
|
||||
|
||||
```
|
||||
---
|
||||
### `prices()`
|
||||
|
|
|
@ -432,6 +432,22 @@ The power of the creature, if applicable
|
|||
Returns:
|
||||
string
|
||||
|
||||
```
|
||||
---
|
||||
### `preview()`
|
||||
|
||||
```
|
||||
Preview information for this card, if any.
|
||||
You may pass the name of a valid key to return the value of that key.
|
||||
Such as a source_uri.
|
||||
|
||||
Args:
|
||||
key (string): A key for specific information about the preview.
|
||||
|
||||
Returns:
|
||||
dict: If provided no key, the entire dict is returned.
|
||||
string: If provided a key, the value of that key is returned.
|
||||
|
||||
```
|
||||
---
|
||||
### `prices()`
|
||||
|
|
|
@ -434,6 +434,22 @@ The power of the creature, if applicable
|
|||
Returns:
|
||||
string
|
||||
|
||||
```
|
||||
---
|
||||
### `preview()`
|
||||
|
||||
```
|
||||
Preview information for this card, if any.
|
||||
You may pass the name of a valid key to return the value of that key.
|
||||
Such as a source_uri.
|
||||
|
||||
Args:
|
||||
key (string): A key for specific information about the preview.
|
||||
|
||||
Returns:
|
||||
dict: If provided no key, the entire dict is returned.
|
||||
string: If provided a key, the value of that key is returned.
|
||||
|
||||
```
|
||||
---
|
||||
### `prices()`
|
||||
|
|
|
@ -430,6 +430,22 @@ The power of the creature, if applicable
|
|||
Returns:
|
||||
string
|
||||
|
||||
```
|
||||
---
|
||||
### `preview()`
|
||||
|
||||
```
|
||||
Preview information for this card, if any.
|
||||
You may pass the name of a valid key to return the value of that key.
|
||||
Such as a source_uri.
|
||||
|
||||
Args:
|
||||
key (string): A key for specific information about the preview.
|
||||
|
||||
Returns:
|
||||
dict: If provided no key, the entire dict is returned.
|
||||
string: If provided a key, the value of that key is returned.
|
||||
|
||||
```
|
||||
---
|
||||
### `prices()`
|
||||
|
|
|
@ -728,4 +728,23 @@ class CardsObject(FoundationObject):
|
|||
"""
|
||||
super(CardsObject, self)._checkForKey('released_at')
|
||||
|
||||
return self.scryfallJson['released_at']
|
||||
return self.scryfallJson['released_at']
|
||||
|
||||
def preview(self, key=None):
|
||||
"""Preview information for this card, if any.
|
||||
You may pass the name of a valid key to return the value of that key.
|
||||
Such as a source_uri.
|
||||
|
||||
Args:
|
||||
key (string): A key for specific information about the preview.
|
||||
|
||||
Returns:
|
||||
dict: If provided no key, the entire dict is returned.
|
||||
string: If provided a key, the value of that key is returned.
|
||||
"""
|
||||
super(CardsObject, self)._checkForKey('preview')
|
||||
|
||||
if key in self.scryfallJson['preview']:
|
||||
return self.scryfallJson['preview'][key]
|
||||
|
||||
return self.scryfallJson['preview']
|
|
@ -17,6 +17,7 @@ transform = Id(id='aae6fb12-b252-453b-bca7-1ea2a0d6c8dc'); time.sleep(0.1)
|
|||
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)
|
||||
|
||||
autocomplete = Autocomplete(q='Thal'); time.sleep(0.1)
|
||||
|
||||
|
@ -207,6 +208,10 @@ class TestCardObjects(unittest.TestCase):
|
|||
def test_oversized(self):
|
||||
self.assertIsInstance(non_online_card.oversized(), bool)
|
||||
|
||||
def test_preview(self):
|
||||
self.assertIsInstance(preview_check.preview(), dict)
|
||||
self.assertIsInstance(preview_check.preview('source'), str)
|
||||
|
||||
class TestAutocomplete(unittest.TestCase):
|
||||
|
||||
def test_object(self):
|
||||
|
|
Loading…
Reference in New Issue