diff options
Diffstat (limited to 'python/tests/transform_elasticsearch.py')
-rw-r--r-- | python/tests/transform_elasticsearch.py | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/python/tests/transform_elasticsearch.py b/python/tests/transform_elasticsearch.py index c11c5972..cee37867 100644 --- a/python/tests/transform_elasticsearch.py +++ b/python/tests/transform_elasticsearch.py @@ -83,15 +83,15 @@ def test_rich_elasticsearch_convert(): assert es['ref_linked_count'] == 1 assert es['preservation'] == "bright" - assert es['is_oa'] == True - assert es['is_longtail_oa'] == False - assert es['is_preserved'] == True - assert es['in_web'] == True - assert es['in_dweb'] == True - assert es['in_ia'] == True - assert es['in_ia_sim'] == False - assert es['in_kbart'] == True - assert es['in_jstor'] == True + assert es['is_oa'] is True + assert es['is_longtail_oa'] is False + assert es['is_preserved'] is True + assert es['in_web'] is True + assert es['in_dweb'] is True + assert es['in_ia'] is True + assert es['in_ia_sim'] is False + assert es['in_kbart'] is True + assert es['in_jstor'] is True def test_elasticsearch_release_from_json(): r = entity_from_json(open('./tests/files/release_etodop5banbndg3faecnfm6ozi.json', 'r').read(), ReleaseEntity) @@ -103,18 +103,18 @@ def test_elasticsearch_release_from_json(): assert es['first_page'] == "1404" assert es['issue'] == "11" assert es['volume'] == "118" - assert es['number'] == None + assert es['number'] is None assert es['preservation'] == "dark" - assert es['is_oa'] == False - assert es['is_longtail_oa'] == False - assert es['is_preserved'] == True - assert es['in_web'] == False - assert es['in_dweb'] == False - assert es['in_ia'] == False - assert es['in_ia_sim'] == True - assert es['in_kbart'] == True - assert es['in_jstor'] == False + assert es['is_oa'] is False + assert es['is_longtail_oa'] is False + assert es['is_preserved'] is True + assert es['in_web'] is False + assert es['in_dweb'] is False + assert es['in_ia'] is False + assert es['in_ia_sim'] is True + assert es['in_kbart'] is True + assert es['in_jstor'] is False # this release has a fileset, and no file r = entity_from_json(open('./tests/files/release_3mssw2qnlnblbk7oqyv2dafgey.json', 'r').read(), ReleaseEntity) @@ -127,15 +127,15 @@ def test_elasticsearch_release_from_json(): assert es['webcapture_count'] == 0 assert es['preservation'] == "dark" - assert es['is_oa'] == True - assert es['is_longtail_oa'] == False - assert es['is_preserved'] == True - assert es['in_web'] == True - assert es['in_dweb'] == True - assert es['in_ia'] == False - assert es['in_ia_sim'] == False - assert es['in_kbart'] == False - assert es['in_jstor'] == False + assert es['is_oa'] is True + assert es['is_longtail_oa'] is False + assert es['is_preserved'] is True + assert es['in_web'] is True + assert es['in_dweb'] is True + assert es['in_ia'] is False + assert es['in_ia_sim'] is False + assert es['in_kbart'] is False + assert es['in_jstor'] is False # this release has a web capture, and no file (edited the JSON to remove file) r = entity_from_json(open('./tests/files/release_mjtqtuyhwfdr7j2c3l36uor7uy.json', 'r').read(), ReleaseEntity) @@ -148,15 +148,15 @@ def test_elasticsearch_release_from_json(): assert es['webcapture_count'] == 1 assert es['preservation'] == "bright" - assert es['is_oa'] == True - assert es['is_longtail_oa'] == False - assert es['is_preserved'] == True - assert es['in_web'] == True - assert es['in_dweb'] == False - assert es['in_ia'] == True - assert es['in_ia_sim'] == False - assert es['in_kbart'] == False - assert es['in_jstor'] == False + assert es['is_oa'] is True + assert es['is_longtail_oa'] is False + assert es['is_preserved'] is True + assert es['in_web'] is True + assert es['in_dweb'] is False + assert es['in_ia'] is True + assert es['in_ia_sim'] is False + assert es['in_kbart'] is False + assert es['in_jstor'] is False def test_elasticsearch_container_transform(journal_metadata_importer): with open('tests/files/journal_metadata.sample.json', 'r') as f: @@ -200,7 +200,7 @@ def test_elasticsearch_container_transform(journal_metadata_importer): assert es['name'] == c2.name assert es['publisher'] == c2.publisher assert es['keepers'] == list(c2.extra['kbart'].keys()) == ["portico"] - assert es['any_kbart'] == True + assert es['any_kbart'] is True def test_elasticsearch_file_transform(): @@ -219,7 +219,7 @@ def test_elasticsearch_file_transform(): assert es['md5'] == fe.md5 # pylint: disable=no-member assert es['size_bytes'] == fe.size # pylint: disable=no-member assert es['mimetype'] == fe.mimetype # pylint: disable=no-member - assert es['in_ia'] == True + assert es['in_ia'] is True assert 'web' in es['rels'] assert 'www.zhros.ru' in es['hosts'] @@ -227,7 +227,7 @@ def test_elasticsearch_file_transform(): assert 'archive.org' in (es['hosts'] + es['domains']) assert 'web.archive.org' in (es['hosts'] + es['domains']) # old regression - assert not '.archive.org' in (es['hosts'] + es['domains']) + assert '.archive.org' not in (es['hosts'] + es['domains']) def test_elasticsearch_changelog_transform(): ce = entity_from_json(open('./tests/files/changelog_3469683.json', 'r').read(), ChangelogEntry) @@ -238,8 +238,8 @@ def test_elasticsearch_changelog_transform(): assert es['timestamp'][:19] == "2020-01-30T05:04:39.738601Z"[:19] assert es['editor_id'] == "scmbogxw25evtcesfcab5qaboa" assert es['username'] == "crawl-bot" - assert es['is_bot'] == True - assert es['is_admin'] == True + assert es['is_bot'] is True + assert es['is_admin'] is True assert es['agent'] == "fatcat_tools.IngestFileResultImporter" assert es['total'] == 50 @@ -279,15 +279,15 @@ def test_elasticsearch_release_kbart_year(): assert es['release_year'] == this_year assert es['preservation'] == "none" - assert es['is_oa'] == True - assert es['is_longtail_oa'] == False - assert es['is_preserved'] == False - assert es['in_web'] == False - assert es['in_dweb'] == False - assert es['in_ia'] == False - assert es['in_ia_sim'] == False - assert es['in_kbart'] == False - assert es['in_jstor'] == False + assert es['is_oa'] is True + assert es['is_longtail_oa'] is False + assert es['is_preserved'] is False + assert es['in_web'] is False + assert es['in_dweb'] is False + assert es['in_ia'] is False + assert es['in_ia_sim'] is False + assert es['in_kbart'] is False + assert es['in_jstor'] is False r.container = ContainerEntity( name="dummy journal", @@ -303,12 +303,12 @@ def test_elasticsearch_release_kbart_year(): assert es['release_year'] == this_year assert es['preservation'] == "dark" - assert es['is_oa'] == True - assert es['is_longtail_oa'] == False - assert es['is_preserved'] == True - assert es['in_web'] == False - assert es['in_dweb'] == False - assert es['in_ia'] == False - assert es['in_ia_sim'] == False - assert es['in_kbart'] == True - assert es['in_jstor'] == False + assert es['is_oa'] is True + assert es['is_longtail_oa'] is False + assert es['is_preserved'] is True + assert es['in_web'] is False + assert es['in_dweb'] is False + assert es['in_ia'] is False + assert es['in_ia_sim'] is False + assert es['in_kbart'] is True + assert es['in_jstor'] is False |