forked from vi3k6i5/flashtext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test case to get all keywords from kp
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from collections import defaultdict | ||
from flashtext import KeywordProcessor | ||
import logging | ||
import unittest | ||
import json | ||
import re | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class TestKPKeywords(unittest.TestCase): | ||
def setUp(self): | ||
logger.info("Starting...") | ||
|
||
def tearDown(self): | ||
logger.info("Ending.") | ||
|
||
def test_list_loading(self): | ||
keyword_processor = KeywordProcessor() | ||
keyword_processor.add_keyword('j2ee', 'Java') | ||
keyword_processor.add_keyword('onGoing', 'rendom') | ||
keyword_processor.get_all_keywords() | ||
self.assertEqual(keyword_processor.get_all_keywords(), | ||
{'j2ee': 'Java', 'ongoing': 'rendom'}, | ||
"get_all_keywords didn't match expected results.") | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |