From 9076998c5d3b64d88a0447ca8a2bc2a09170790b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Arbel=C3=A1ez?= Date: Sun, 9 Aug 2020 13:00:10 -0500 Subject: [PATCH] Fix little bug --- .github/workflows/pythonpackage.yml | 4 ++-- .zenodo.json | 4 ++-- HISTORY.md | 7 ++++++- setup.cfg | 2 -- setup.py | 2 +- tests/test_collection_cached.py | 2 +- wostools/__init__.py | 2 +- wostools/_testutils.py | 2 +- wostools/article.py | 4 +++- 9 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index e905151..9c72c5e 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -25,8 +25,8 @@ jobs: run: | pip install flake8 # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 wostools tests --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --statistics + flake8 wostools tests --count --exit-zero --statistics - name: Test with pytest run: python setup.py test diff --git a/.zenodo.json b/.zenodo.json index 24fc819..8f0b7cd 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -2,7 +2,7 @@ "description": "Translates isi web of knowledge files into python objects.", "license": "MIT", "title": "coreofscience/python-wostools", - "version": "v2.0.0", + "version": "v2.0.1", "upload_type": "software", "publication_date": "2018-08-13", "creators": [ @@ -25,7 +25,7 @@ "related_identifiers": [ { "scheme": "url", - "identifier": "https://github.com/coreofscience/python-wostools/tree/v2.0.0", + "identifier": "https://github.com/coreofscience/python-wostools/tree/v2.0.1", "relation": "isSupplementTo" }, { diff --git a/HISTORY.md b/HISTORY.md index c389fd6..73d20dd 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,11 @@ # History -## 2.0.0 (2020-08-09) +## 2.0.1 (2020-08-09) + +- Fix error with wos files that have an invisible character before the field + key. + +## 2.0.0 (2020-08-08) - Make the article class more concrete - Make collections iterable diff --git a/setup.cfg b/setup.cfg index aefb114..6b1a61f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,5 +11,3 @@ select = B,C,E,F,W,T4,B9 [aliases] test = pytest -[tool:pytest] -collect_ignore = ['setup.py'] diff --git a/setup.py b/setup.py index 9d07288..16c8ed3 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ test_suite="tests", tests_require=test_requirements, url="https://github.com/coreofscience/python-wostools", - version="2.0.0", + version="2.0.1", zip_safe=False, long_description_content_type="text/markdown", ) diff --git a/tests/test_collection_cached.py b/tests/test_collection_cached.py index 0ef0530..fe9a04f 100644 --- a/tests/test_collection_cached.py +++ b/tests/test_collection_cached.py @@ -1,5 +1,5 @@ import io -from typing import Collection, List, Dict, Tuple +from typing import List, Dict, Tuple from pytest import fixture from pytest_bdd import scenarios, given, when, then diff --git a/wostools/__init__.py b/wostools/__init__.py index 5885702..5844bd0 100644 --- a/wostools/__init__.py +++ b/wostools/__init__.py @@ -2,7 +2,7 @@ __author__ = """Core of Science""" __email__ = "dev@coreofscience.com" -__version__ = "2.0.0" +__version__ = "2.0.1" from wostools.article import Article from wostools.lazy import LazyCollection diff --git a/wostools/_testutils.py b/wostools/_testutils.py index 0e4dc9b..2c55b6b 100644 --- a/wostools/_testutils.py +++ b/wostools/_testutils.py @@ -35,7 +35,7 @@ def assert_data(self, name=None) -> Iterator[T]: @contextmanager def assert_error(self) -> Iterator[Exception]: - assert self.error, f"Expected an error and found none" + assert self.error, "Expected an error and found none" yield self.error @contextmanager diff --git a/wostools/article.py b/wostools/article.py index e66c11f..43dbb56 100644 --- a/wostools/article.py +++ b/wostools/article.py @@ -9,7 +9,9 @@ logger = logging.getLogger(__name__) # The null part accounts for an ISI wok bug -ISI_LINE_PATTERN = re.compile(r"^(null)?((?P[A-Z0-9]{2})| )( (?P.*))?$") +ISI_LINE_PATTERN = re.compile( + r"^(null|.)?((?P[A-Z0-9]{2})| )( (?P.*))?$" +) ISI_CITATION_PATTERN = re.compile( r"""^(?P[^,]+)?,[ ] # First author