forked from titipata/pubmed_parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
language: python | ||
env: | ||
- PYTHON=3.5 | ||
- PYTHON=3.6 | ||
- PYTHON=3.7 | ||
- PYTHON=3.8 | ||
|
||
miniconda: | ||
- wget -q http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh | ||
- chmod +x miniconda.sh | ||
- ./miniconda.sh -b -p /home/travis/miniconda | ||
- export PATH=/home/travis/miniconda/bin:$PATH | ||
- conda update --yes conda | ||
|
||
install: | ||
- conda create -n testenv --yes pip python=$PYTHON | ||
- source activate testenv | ||
- conda install --yes --file requirements.txt | ||
- python setup.py install | ||
|
||
script: | ||
- py.test --cov=pubmed_parser tests/ --verbose | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
lxml | ||
unidecode | ||
requests | ||
six | ||
numpy | ||
pytest | ||
pytest-cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,35 @@ | |
author='Titipat Achakulvisut', | ||
author_email='[email protected]', | ||
license='(c) 2015 - 2019 Titipat Achakulvisut, Daniel E. Acuna', | ||
install_requires=['lxml', 'unidecode', 'requests', 'six', 'numpy'], | ||
install_requires=[ | ||
'lxml', 'unidecode', 'requests', | ||
'six', 'numpy', 'pytest', | ||
'pytest-cov' | ||
], | ||
packages=['pubmed_parser'], | ||
package_data={ | ||
'pubmed_parser.data': ['*.xml.gz', '*.nxml', '*.txt'], | ||
}, | ||
classifiers=[ | ||
"Intended Audience :: Science/Research", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
"Topic :: Software Development", | ||
"Topic :: Scientific/Engineering", | ||
"Operating System :: Microsoft :: Windows", | ||
"Operating System :: Unix", | ||
"Operating System :: MacOS", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.5", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8" | ||
], | ||
platforms='any', | ||
project_urls={ | ||
'Source': 'https://github.com/titipata/pubmed_parser', | ||
'Documentation': 'http://titipata.github.io/pubmed_parser', | ||
'Bug Reports': 'https://github.com/titipata/pubmed_parser/issues' | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os | ||
import pytest | ||
|
||
import pubmed_parser as pp | ||
|
||
|
||
def test_parse_medline_xml(): | ||
""" | ||
Test parse captions and figure ID from an XML file | ||
""" | ||
parsed_xml = pp.parse_pubmed_xml(os.path.join('data', 'pone.0046493.nxml')) | ||
assert len(parsed_xml.get('abstract')) > 0 | ||
assert len(parsed_xml.get('full_title')) > 0 | ||
assert parsed_xml.get('pmc') == '3460867' | ||
assert parsed_xml.get('doi') == '10.1371/journal.pone.0046493' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
import pytest | ||
|
||
import pubmed_parser as pp | ||
|
||
|
||
def test_parse_pubmed_xml(): | ||
""" | ||
Test parse captions and figure ID from an XML file | ||
""" | ||
parsed_xml = pp.parse_pubmed_xml(os.path.join('data', 'pone.0046493.nxml')) | ||
assert len(parsed_xml.get('abstract')) > 0 | ||
assert len(parsed_xml.get('full_title')) > 0 | ||
assert parsed_xml.get('pmc') == '3460867' | ||
assert parsed_xml.get('doi') == '10.1371/journal.pone.0046493' | ||
|
||
|
||
def test_parse_pubmed_caption(): | ||
""" | ||
Test parse captions and figure ID from an XML file | ||
""" | ||
paragraphs = pp.parse_pubmed_paragraph(os.path.join('data', 'pone.0046493.nxml')) | ||
assert isinstance(paragraphs[0], dict) | ||
|
||
|
||
def test_parse_pubmed_references(): | ||
""" | ||
Test parse references from an XML file | ||
""" | ||
references = pp.parse_pubmed_paragraph(os.path.join('data', 'pone.0046493.nxml')) | ||
assert isinstance(references[0], dict) |