From cc1d6dc50262201d6bf6fd4ac5ea8289c4e8071e Mon Sep 17 00:00:00 2001 From: Madison May Date: Thu, 18 Dec 2014 01:04:10 -0500 Subject: [PATCH] Tests for updated text tags api --- CHANGES.txt | 1 + indicoio/__init__.py | 2 +- setup.py | 2 +- tests/remote/test_remote.py | 14 +------------- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 0e02727..3cfc560 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,3 +13,4 @@ v0.4.4, Thu Sep 25 -- Added dependencies installation to setup.py v0.4.5, Thu Sep 25 -- Added interface to local indico server v0.4.6, Fri Oct 27 -- Updated to point to new indico api servers, cleaner REST API v0.4.8, Fri Nov 7 -- Updated API interface to include new text tags API +v0.4.11, Wed Dec 18 -- Updated tests for text tags \ No newline at end of file diff --git a/indicoio/__init__.py b/indicoio/__init__.py index 2309126..f395523 100644 --- a/indicoio/__init__.py +++ b/indicoio/__init__.py @@ -3,7 +3,7 @@ import indicoio.config as config JSON_HEADERS = {'Content-type': 'application/json', 'Accept': 'text/plain'} -Version, version, __version__, VERSION = ('0.4.5',) * 4 +Version, version, __version__, VERSION = ('0.4.11',) * 4 from indicoio.text.sentiment import political, posneg from indicoio.text.sentiment import posneg as sentiment diff --git a/setup.py b/setup.py index 248b9d7..8070614 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ except ImportError: setup( name="IndicoIo", - version='0.4.8', + version='0.4.11', packages=[ "indicoio", "indicoio.text", diff --git a/tests/remote/test_remote.py b/tests/remote/test_remote.py index 1477822..3427d7e 100644 --- a/tests/remote/test_remote.py +++ b/tests/remote/test_remote.py @@ -23,22 +23,10 @@ class FullAPIRun(unittest.TestCase): self.assertTrue(np.ptp(vector) > span) def test_text_tags(self): - expected_keys = set(['fashion', 'art', 'energy', 'economics', 'entrepreneur', - 'books', 'politics', 'gardening', 'nba', 'conservative', - 'technology', 'startups', 'relationships', 'education', - 'humor', 'psychology', 'bicycling', 'investing', 'travel', - 'cooking', 'christianity', 'environment', 'religion', 'health', - 'hockey', 'pets', 'music', 'soccer', 'guns', 'gaming', 'jobs', - 'business', 'nature', 'food', 'cars', 'photography', 'philosophy', - 'geek', 'sports', 'baseball', 'news', 'television', 'entertainment', - 'parenting', 'comics', 'science', 'nfl','programming', - 'personalfinance', 'atheism', 'movies', 'anime', 'fitness', - 'military', 'realestate', 'history']) text = "On Monday, president Barack Obama will be..." results = text_tags(text) max_keys = sorted(results.keys(), key=lambda x:results.get(x), reverse=True) - assert 'politics' in max_keys[:3] - self.assertFalse(set(results.keys()) - expected_keys) + assert 'political_discussion' in max_keys[:5] def test_political(self): political_set = set(['Libertarian', 'Liberal', 'Conservative', 'Green'])