aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-22 13:46:42 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-22 13:46:42 -0700
commitdb40b9e70b917dbbbfda48f6d77a2fc509366a82 (patch)
treee66626601ec32965c4cee7fad16982530408019b /tests
parent5d3ce061d24a5188fc015012b2f70a4c6f568969 (diff)
downloadchocula-db40b9e70b917dbbbfda48f6d77a2fc509366a82.tar.gz
chocula-db40b9e70b917dbbbfda48f6d77a2fc509366a82.zip
fmt (black)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_database.py10
-rw-r--r--tests/test_directories.py9
2 files changed, 10 insertions, 9 deletions
diff --git a/tests/test_database.py b/tests/test_database.py
index 3d41e79..dc75d23 100644
--- a/tests/test_database.py
+++ b/tests/test_database.py
@@ -1,4 +1,3 @@
-
from chocula.database import IssnDatabase
@@ -6,10 +5,9 @@ def test_issn_database():
issn_db = IssnDatabase(issn_issnl_file_path="tests/files/ISSN-to-ISSN-L.txt")
- assert issn_db.issn2issnl('1234-5678') is None
- assert issn_db.issn2issnl('0000-0000') is None
+ assert issn_db.issn2issnl("1234-5678") is None
+ assert issn_db.issn2issnl("0000-0000") is None
# "The Lancet"
- assert issn_db.issn2issnl('0140-6736') == '0140-6736'
- assert issn_db.issn2issnl('1474-547X') == '0140-6736'
-
+ assert issn_db.issn2issnl("0140-6736") == "0140-6736"
+ assert issn_db.issn2issnl("1474-547X") == "0140-6736"
diff --git a/tests/test_directories.py b/tests/test_directories.py
index 90856bc..b366192 100644
--- a/tests/test_directories.py
+++ b/tests/test_directories.py
@@ -1,26 +1,29 @@
-
import pytest
from chocula import *
+
@pytest.fixture
def config():
config = ChoculaConfig.from_file(sources_dir="tests/files/")
return config
+
@pytest.fixture
def issn_db():
return IssnDatabase(issn_issnl_file_path="tests/files/ISSN-to-ISSN-L.txt")
+
@pytest.fixture
def database(issn_db):
db = ChoculaDatabase(db_file=":memory:", issn_db=issn_db)
db.init_db()
return db
+
def test_all(config, database):
for cls in ALL_CHOCULA_DIR_CLASSES:
loader = cls(config)
counts = loader.index_file(database)
- assert counts['total'] >= 20
- assert counts['inserted'] > 5
+ assert counts["total"] >= 20
+ assert counts["inserted"] > 5