Skip to content

Commit

Permalink
Fixed some tests so they are more consistent overall
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Myers committed Jun 12, 2012
1 parent 38a14b6 commit 49f2ab9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions positive_category_words/test_weighted_positivity.py
Expand Up @@ -10,7 +10,7 @@
COMPANY = u'Company'
REVIEW_TEMPLATE = '{"type":"review", "stars":3, "text":"%s",\
"business_id":"%s"}\n'
BUSINESS_TEMPLATE = '{"type":"business", "categories":["%s"], \
BUSINESS_TEMPLATE = '{"type":"business", "categories":["Company"], \
"business_id":"%s"}\n'
TEXT = u"Hello world"
BIZ_NAME = u'Qdoba'
Expand Down Expand Up @@ -55,8 +55,8 @@ def test_review_category(self):
business = BUSINESS_TEMPLATE % BIZ_NAME

job = WeightedPositiveWords()
results = (BIZ_NAME, ('review', (TEXT, 3))),
(BIZ_NAME, ('categories', [COMPANY]))
results = ((BIZ_NAME, ('review', (TEXT, 3))),
(BIZ_NAME, ('categories', [COMPANY])))
self.assertEqual(
job.review_category_mapper(None, json.loads(review)).next(),
results[0]
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_review_mapper(self):
biz_review_positivity = (BIZ_NAME, (TEXT, 3))

job = WeightedPositiveWords()
results = ((COMPANY, 'awesome'), (BIZ_NAME, 3))
results = ((COMPANY, u'world'), (BIZ_NAME, 3))
self.assertEqual(
job.review_mapper(COMPANY, biz_review_positivity).next(),
results
Expand Down
7 changes: 3 additions & 4 deletions review_autopilot/test_autopilot.py
Expand Up @@ -37,9 +37,8 @@ def test_smoke(self):
too long."""
#Random data to feed into the markov model.
#I use long runs of foo to get through the threshold filters.
text = '"foo bar foo baz foo car foo daz' + 'foo' * 10 + 'foofoo yelp \
foo yar foo foo bar bar dar"'

text = 'foo bar foo baz foo car foo daz ' + ('foo ' * 10) + 'foofoo yelp \
foo yar foo foo bar bar dar'
single_review = REVIEW_TEMPLATE % (text, BIZ)
business = BUSINESS_TEMPLATE % (CATEGORIES, BIZ)
static_stdin = StringIO(single_review + business)
Expand Down Expand Up @@ -70,7 +69,7 @@ def test_categories_reducer(self):
def test_split_mapper(self):
"""Tests split_mapper reducer in autopilot"""
job = ReviewAutoPilot()
TEST_RETURN = (('is', 'F'), ('a', 1))
TEST_RETURN = (('hello', 'C'), ('<end>', 1))
self.assertEqual(job.review_split_mapper(CATEGORIES, TEXT).next(),
TEST_RETURN)

Expand Down

0 comments on commit 49f2ab9

Please sign in to comment.