Skip to content

Commit

Permalink
Fix method names in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Apr 18, 2020
1 parent f13860a commit e76984c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ OCDS Kingfisher Colab

.. automodule:: ocdskingfishercolab
:members:
:undoc-members:
22 changes: 11 additions & 11 deletions tests/test_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import psycopg2
import pytest

from ocdskingfishercolab import create_connection, download_releases, output_notebook
from ocdskingfishercolab import create_connection, download_releases_as_package, get_dataframe_from_query


@pytest.fixture
Expand Down Expand Up @@ -54,9 +54,9 @@ def chdir(path):


@patch('google.colab.files.download')
def test_download_releases_release(mocked, db, tmpdir):
def test_download_releases_as_package_release(mocked, db, tmpdir):
with chdir(tmpdir):
download_releases(1, 'ocds-213czf-1', 'release')
download_releases_as_package(1, 'ocds-213czf-1', 'release')

with open('ocds-213czf-1_release_package.json') as f:
data = json.load(f)
Expand All @@ -67,9 +67,9 @@ def test_download_releases_release(mocked, db, tmpdir):


@patch('google.colab.files.download')
def test_download_releases_record(mocked, db, tmpdir):
def test_download_releases_as_package_record(mocked, db, tmpdir):
with chdir(tmpdir):
download_releases(1, 'ocds-213czf-1', 'record')
download_releases_as_package(1, 'ocds-213czf-1', 'record')

with open('ocds-213czf-1_record_package.json') as f:
data = json.load(f)
Expand All @@ -85,14 +85,14 @@ def test_download_releases_record(mocked, db, tmpdir):


@patch('sys.stdout', new_callable=StringIO)
def test_download_releases_other(stdout):
download_releases(1, 'ocds-213czf-1', 'other')
def test_download_releases_as_package_other(stdout):
download_releases_as_package(1, 'ocds-213czf-1', 'other')

assert stdout.getvalue() == "package_type parameter must be either 'release' or 'record'\n"


def test_output_notebook(db):
dataframe = output_notebook('SELECT * FROM release')
def test_get_dataframe_from_query(db):
dataframe = get_dataframe_from_query('SELECT * FROM release')

assert dataframe.to_dict() == {
'collection_id': {0: 1},
Expand All @@ -102,8 +102,8 @@ def test_output_notebook(db):
}


def test_output_notebook_error(db):
def test_get_dataframe_from_query_error(db):
with pytest.raises(psycopg2.errors.SyntaxError) as excinfo:
output_notebook('invalid')
get_dataframe_from_query('invalid')

assert str(excinfo.value) == 'syntax error at or near "invalid"\nLINE 1: invalid\n ^\n'

0 comments on commit e76984c

Please sign in to comment.