Skip to content

Commit

Permalink
Merge pull request #11 from NYU-CI/troubleshoot
Browse files Browse the repository at this point in the history
fixes for #10
  • Loading branch information
ceteri authored Dec 1, 2019
2 parents a838490 + ff819f7 commit 54bc3a0
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__

# testing junk
.coverage
venv

# Setuptools distribution folder
/dist/
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,8 @@ The State of OA: A large-scale analysis of the prevalence and impact of Open Acc

## Testing

First, be sure that you're testing the source and not from an installed library:

```
pip uninstall richcontext-scholapi
```
First, be sure that you're testing the source and not from an
installed library.

Then run unit tests for the APIs which do not require credentials:

Expand Down
9 changes: 9 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# `richcontext.scholapi` changelog

## 1.0.1

2019-11-30

### Fixed

* EuropePMC: resolved edge case where returned titles could be null, causing exceptions


## 1.0.0

2019-11-23
Expand Down
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
doi = "10.1016/j.appet.2017.07.006"

# run it...
meta = schol.openaire.title_search(title)
meta = schol.europepmc.title_search(title)

# report results
pprint.pprint(meta)
Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion richcontext/scholapi/scholapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def title_match (self, title0, title1):
"""
within reason, do the two titles match?
"""
return self.clean_title(title0) == self.clean_title(title1)
if not title0 or not title1:
return False
else:
return self.clean_title(title0) == self.clean_title(title1)


def get_api_url (self, *args):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="richcontext-scholapi",
version="1.0.0",
version="1.0.1",
author="Coleridge Initiative",
author_email="[email protected]",
description="Rich Context API integrations for federating metadata discovery and exchange across multiple scholarly infrastructure providers",
Expand All @@ -17,7 +17,7 @@
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Information Technology",
Expand Down
4 changes: 2 additions & 2 deletions test/test.py → test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class TestOpenAPIs (unittest.TestCase):

def test_europepmc_title_search (self):
schol = rc_scholapi.ScholInfraAPI(config_file="rc.cfg")
title = "Deal or no deal? The prevalence and nutritional quality of price promotions among U.S. food and beverage purchases."
title = "Zebrafish models: Gaining insight into purinergic signaling and neurological disorders"
meta = schol.europepmc.title_search(title)

print("\ntime: {:.3f} ms - {}".format(schol.europepmc.elapsed_time, schol.europepmc.name))
self.assertTrue(repr(meta) == "OrderedDict([('doi', '10.1016/j.appet.2017.07.006'), ('pmcid', 'PMC5574185'), ('journal', 'Appetite'), ('authors', ['Taillie LS', 'Ng SW', 'Xue Y', 'Harding M.']), ('pdf', 'http://europepmc.org/articles/PMC5574185?pdf=render')])")
self.assertTrue(repr(meta) == "OrderedDict([('doi', '10.1016/j.pnpbp.2019.109770'), ('pmcid', None), ('journal', 'Prog Neuropsychopharmacol Biol Psychiatry'), ('authors', ['Nabinger DD', 'Altenhofen S', 'Bonan CD.'])])")


def test_openaire_title_search (self):
Expand Down

0 comments on commit 54bc3a0

Please sign in to comment.