mirror of https://gitlab.com/bashrc2/epicyon
Fix test
parent
33ecd05abb
commit
8485371197
|
@ -165,6 +165,9 @@ def guessHashtagCategory(tagName: str, hashtagCategories: {}) -> str:
|
|||
"""Tries to guess a category for the given hashtag.
|
||||
This works by trying to find the longest similar hashtag
|
||||
"""
|
||||
if len(tagName) < 4:
|
||||
return ''
|
||||
|
||||
categoryMatched = ''
|
||||
tagMatchedLen = 0
|
||||
|
||||
|
@ -185,5 +188,5 @@ def guessHashtagCategory(tagName: str, hashtagCategories: {}) -> str:
|
|||
if len(hashtag) > tagMatchedLen:
|
||||
categoryMatched = categoryStr
|
||||
if not categoryMatched:
|
||||
return
|
||||
return ''
|
||||
return categoryMatched
|
||||
|
|
4
tests.py
4
tests.py
|
@ -2843,12 +2843,12 @@ def _testGuessHashtagCategory() -> None:
|
|||
print('testGuessHashtagCategory')
|
||||
hashtagCategories = {
|
||||
"foo": ["swan", "goose"],
|
||||
"bar": ["cat", "mouse"]
|
||||
"bar": ["cats", "mouse"]
|
||||
}
|
||||
guess = guessHashtagCategory("unspecifiedgoose", hashtagCategories)
|
||||
assert guess == "foo"
|
||||
|
||||
guess = guessHashtagCategory("catpic", hashtagCategories)
|
||||
guess = guessHashtagCategory("mastocats", hashtagCategories)
|
||||
assert guess == "bar"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue