Skip to content

Commit

Permalink
feat: Refactor tests/test_jieba.py to be more modu
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Jan 3, 2024
1 parent 77f7764 commit 77d7d1b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_jieba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import unittest

import jieba


class TestJieba(unittest.TestCase):
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'])

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

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

if __name__ == '__main__':
unittest.main()

0 comments on commit 77d7d1b

Please sign in to comment.