Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Vela-zz committed Dec 4, 2023
1 parent f1cdb36 commit 00a5d47
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import unittest
import hanlp


class TestPipeLine(unittest.TestCase):
def test_copy(self):
pipe = hanlp.pipeline().append(hanlp.utils.rules.split_sentence)
copied_pipe = pipe.copy()
test_text = "今天天气真好。我要去散步。"
assert pipe is not copied_pipe
copied_pipe.append(lambda sent: "".join(sent))
assert pipe(test_text) != copied_pipe(test_text)

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

0 comments on commit 00a5d47

Please sign in to comment.