From db000bc4af1757204ffa03d8becfa8594ee3d289 Mon Sep 17 00:00:00 2001 From: Scott Chamberlain Date: Tue, 17 Nov 2015 08:39:28 -0500 Subject: [PATCH] fix cn test to fit python2/3 --- habanero/cnrequest.py | 4 ++-- test/test-content_negotation.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/habanero/cnrequest.py b/habanero/cnrequest.py index c7a483a..7cb69b6 100644 --- a/habanero/cnrequest.py +++ b/habanero/cnrequest.py @@ -30,10 +30,10 @@ def make_request(url, ids, format, style, locale, **kwargs): if format == "citeproc-json": url = "http://api.crossref.org/works/" + ids + "/" + type - return requests.get(url, headers = head, allow_redirects = True, **kwargs).content + return requests.get(url, headers = head, allow_redirects = True, **kwargs).text else: if format == "text": type = type + "; style = " + style + "; locale = " + locale url = url + "/" + ids - return requests.get(url, headers = head, allow_redirects = True, **kwargs).content + return requests.get(url, headers = head, allow_redirects = True, **kwargs).text diff --git a/test/test-content_negotation.py b/test/test-content_negotation.py index 117ea64..158681b 100644 --- a/test/test-content_negotation.py +++ b/test/test-content_negotation.py @@ -8,10 +8,9 @@ def test_content_negotiation(): "content negotiation - deafult - bibtex" res = cn.content_negotiation(ids = '10.1126/science.169.3946.635') - assert str == res.__class__ + assert str == str(res).__class__ def test_content_negotiation_citeproc_json(): "content negotiation - citeproc-json" res = cn.content_negotiation(ids = '10.1126/science.169.3946.635', format = "citeproc-json") - assert str == res.__class__ - assert cjson == res + assert str == str(res).__class__