Skip to content

Commit

Permalink
feat: Updated tests/test_jieba.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Jan 3, 2024
1 parent 77d7d1b commit a158df6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_jieba.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ def setUp(self):
self.text = "This is a test text for jieba"

def test_cut(self):
result = jieba.cut(self.text)
self.assertEqual(list(result), ['This', ' ', 'is', ' ', 'a', ' ', 'test', ' ', 'text', ' ', 'for', ' ', 'jieba'])
self._test_cut_method(jieba.cut, ['This', ' ', 'is', ' ', 'a', ' ', 'test', ' ', 'text', ' ', 'for', ' ', 'jieba'])

def test_cut_all(self):
result = jieba.cut(self.text, cut_all=True)
self.assertEqual(list(result), ['This', ' ', 'is', ' ', 'a', ' ', 'test', ' ', 'text', ' ', 'for', ' ', 'jieba'])
self._test_cut_method(jieba.cut, ['This', ' ', 'is', ' ', 'a', ' ', 'test', ' ', 'text', ' ', 'for', ' ', 'jieba'], cut_all=True)

def test_cut_for_search(self):
result = jieba.cut_for_search(self.text)
self.assertEqual(list(result), ['This', ' ', 'is', ' ', 'a', ' ', 'test', ' ', 'text', ' ', 'for', ' ', 'jieba'])
self._test_cut_method(jieba.cut_for_search, ['This', ' ', 'is', ' ', 'a', ' ', 'test', ' ', 'text', ' ', 'for', ' ', 'jieba'])

if __name__ == '__main__':
unittest.main()
def _test_cut_method(self, method, expected_result, **kwargs):
result = method(self.text, **kwargs)
self.assertEqual(list(result), expected_result)

0 comments on commit a158df6

Please sign in to comment.