Merge pull request #47 from silasary/ci
Add CI workflow, and fix bulk data uri
This commit is contained in:
commit
2e3aa5bb95
|
@ -0,0 +1,26 @@
|
||||||
|
name: Python Tests
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.5, 3.6, 3.7, 3.8]
|
||||||
|
|
||||||
|
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
|
|
@ -5,6 +5,7 @@ import asyncio
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
import warnings
|
||||||
|
|
||||||
class BulkData(FoundationObject):
|
class BulkData(FoundationObject):
|
||||||
"""
|
"""
|
||||||
|
@ -164,6 +165,10 @@ class BulkData(FoundationObject):
|
||||||
return self.scryfallJson['data'][num]['compressed_size']
|
return self.scryfallJson['data'][num]['compressed_size']
|
||||||
|
|
||||||
def bulk_permalink_uri(self, num):
|
def bulk_permalink_uri(self, num):
|
||||||
|
warnings.warn("This method has been renamed to bulk_uri as per https://scryfall.com/blog/updates-to-bulk-data-and-cards-deprecation-notice-217", DeprecationWarning)
|
||||||
|
return self.bulk_uri(num)
|
||||||
|
|
||||||
|
def bulk_uri(self, num):
|
||||||
"""The URL that hosts the bulk file
|
"""The URL that hosts the bulk file
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -172,9 +177,9 @@ class BulkData(FoundationObject):
|
||||||
Returns:
|
Returns:
|
||||||
string: A URI to download the compressed data
|
string: A URI to download the compressed data
|
||||||
"""
|
"""
|
||||||
super(BulkData, self)._checkForTupleKey('data', num, 'permalink_uri')
|
super(BulkData, self)._checkForTupleKey('data', num, 'uri')
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['permalink_uri']
|
return self.scryfallJson['data'][num]['uri']
|
||||||
|
|
||||||
def bulk_content_type(self, num):
|
def bulk_content_type(self, num):
|
||||||
"""The MIME type of the file
|
"""The MIME type of the file
|
||||||
|
|
|
@ -41,8 +41,8 @@ class TestBulk(unittest.TestCase):
|
||||||
self.assertIsInstance(bulk.bulk_compressed_size(0), int)
|
self.assertIsInstance(bulk.bulk_compressed_size(0), int)
|
||||||
self.assertIsInstance(bulk.bulk_compressed_size(0, True), str)
|
self.assertIsInstance(bulk.bulk_compressed_size(0, True), str)
|
||||||
|
|
||||||
def test_bulk_permalink_uri(self):
|
def test_bulk_uri(self):
|
||||||
self.assertIsInstance(bulk.bulk_permalink_uri(0), str)
|
self.assertIsInstance(bulk.bulk_uri(0), str)
|
||||||
|
|
||||||
def test_bulk_content_type(self):
|
def test_bulk_content_type(self):
|
||||||
self.assertIsInstance(bulk.bulk_content_type(0), str)
|
self.assertIsInstance(bulk.bulk_content_type(0), str)
|
Loading…
Reference in New Issue