diff options
-rw-r--r-- | fatcat/sql.py | 6 | ||||
-rw-r--r-- | tests/api.py | 14 | ||||
-rw-r--r-- | tests/entity_lifecycle.py | 2 | ||||
-rw-r--r-- | tests/fixtures.py | 4 | ||||
-rw-r--r-- | tests/models.py | 4 | ||||
-rw-r--r-- | tests/routes.py | 2 |
6 files changed, 16 insertions, 16 deletions
diff --git a/fatcat/sql.py b/fatcat/sql.py index f05bd0ee..34a4147d 100644 --- a/fatcat/sql.py +++ b/fatcat/sql.py @@ -122,15 +122,15 @@ def merge_works(left_id, right_id, editgroup=None): right = WorkIdent.query.filter(WorkIdent.id == right_id).first_or_404() assert left.is_live and right.is_live assert left.rev and right.rev - assert (left.redirect_id == None) and (right.redirect_id == None) + assert (left.redirect_id is None) and (right.redirect_id is None) if editgroup is None: editgroup = fatcat.api.get_or_create_editgroup() releases = ReleaseIdent.query\ .join(ReleaseIdent.rev)\ - .filter(ReleaseRev.work_ident_id == right_id)\ - .filter(ReleaseIdent.is_live == True)\ + .filter(ReleaseRev.work_ident_id==right_id)\ + .filter(ReleaseIdent.is_live==True)\ .all() # update all right releases to point to left diff --git a/tests/api.py b/tests/api.py index 7e487f17..bb7007c1 100644 --- a/tests/api.py +++ b/tests/api.py @@ -1,8 +1,8 @@ import json -import pytest import unittest import tempfile +import pytest import fatcat import fatcat.sql from fatcat.models import * @@ -196,18 +196,18 @@ def test_api_rich_create(app): # Test that foreign key relations worked release_rv = json.loads(app.get('/v0/release/{}'.format(release_id)).data.decode('utf-8')) print(release_rv) - assert(release_rv['creators'][0]['creator'] == creator_id) - assert(release_rv['container']['id'] == container_id) - assert(release_rv['work']['id'] == work_id) - assert(release_rv['refs'][0]['target'] == stub_release_id) + assert release_rv['creators'][0]['creator'] == creator_id + assert release_rv['container']['id'] == container_id + assert release_rv['work']['id'] == work_id + assert release_rv['refs'][0]['target'] == stub_release_id file_rv = json.loads(app.get('/v0/file/{}'.format(file_id)).data.decode('utf-8')) print(file_rv) - assert(file_rv['releases'][0]['release'] == release_id) + assert file_rv['releases'][0]['release'] == release_id # test that editor's active edit group is now invalid editor = Editor.query.first() - assert editor.active_editgroup == None + assert editor.active_editgroup is None def test_api_release_lookup(rich_app): app = rich_app diff --git a/tests/entity_lifecycle.py b/tests/entity_lifecycle.py index 9f5b4040..4ac7ee68 100644 --- a/tests/entity_lifecycle.py +++ b/tests/entity_lifecycle.py @@ -1,8 +1,8 @@ import json -import pytest import unittest import tempfile +import pytest import fatcat import fatcat.sql from fatcat.models import * diff --git a/tests/fixtures.py b/tests/fixtures.py index 30358a5c..d3d8c24b 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -2,8 +2,8 @@ import os import time import json -import pytest import signal +import pytest import fatcat import fatcat.sql from fatcat.models import * @@ -151,7 +151,7 @@ def check_entity_fields(e): def check_release(e): for key in ('work', 'release_type'): assert key in e - for key in ('title'): + for key in ('title', ): assert e[key] is not None for key in ('refs', 'creators'): assert type(e[key]) == list diff --git a/tests/models.py b/tests/models.py index e969992b..98bb6bc7 100644 --- a/tests/models.py +++ b/tests/models.py @@ -1,8 +1,8 @@ import json -import pytest import unittest import tempfile +import pytest import fatcat import fatcat.sql from fatcat.models import * @@ -36,7 +36,7 @@ def test_schema_release_rev(app): model_after = ReleaseRev.query.first() serial = release_rev_schema.dump(model_after).data #check_release(serial) - for k in e.keys(): + for k in e: assert e[k] == serial[k] def test_schema_creator_rev(app): diff --git a/tests/routes.py b/tests/routes.py index d74412b6..5b9f0ca9 100644 --- a/tests/routes.py +++ b/tests/routes.py @@ -1,9 +1,9 @@ import json +import tempfile import pytest import fatcat import fatcat.sql -import tempfile from fatcat.models import * from fixtures import * |