Skip to content

Commit

Permalink
Ignore extra spaces in keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Nov 17, 2016
1 parent 1cfdb44 commit 24de992
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion memegen/domain/template.py
Expand Up @@ -100,7 +100,8 @@ def keywords(self):
words = set()
for fields in [self.key, self.name] + self.aliases + self.lines:
for word in fields.lower().replace('-', ' ').split(' '):
words.add(word)
if word:
words.add(word)
return words

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion memegen/tests/test_domain_template.py
Expand Up @@ -108,7 +108,7 @@ def is_placeholder_when_no_lines(template):
def describe_keywords():

def is_the_set_of_all_relevant_terms(template):
template.lines[0] = "A day in the life"
template.lines[0] = "A day in the life"

expect(template.keywords) == \
{'bar', 'the', 'day', 'in', 'abc', 'a', 'life'}
Expand Down

0 comments on commit 24de992

Please sign in to comment.