From 6b8a277e05b0a6e32a31499bb7a503354e278e9e Mon Sep 17 00:00:00 2001 From: Choe Hwanjin Date: Sat, 19 Nov 2005 16:12:31 +0900 Subject: [PATCH] add pyhangul test code pyhangul/test_pyhangul.py git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@41 8f00fcd2-89fc-0310-932e-b01be5b65e01 --- pyhangul/test_pyhangul.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pyhangul/test_pyhangul.py diff --git a/pyhangul/test_pyhangul.py b/pyhangul/test_pyhangul.py new file mode 100644 index 0000000..9fd5b24 --- /dev/null +++ b/pyhangul/test_pyhangul.py @@ -0,0 +1,28 @@ +# coding: utf-8 +# +# Author: Gyoung-Yoon Noh +# License: Same as libhangul. + +import sys +import hangul +import unittest + +class TestHangul(unittest.TestCase): + def setUp(self): + self.ic = hangul.create_ic(hangul.hangul2) + + def testSimpleString(self): + input = u"vkdlTjs gksrmf fkdlqmfjfl xptmxm" + output = u"파이썬 한글 라이브러리 테스트" + buffer = u'' + for i in input: + ret = self.ic.filter(ord(i)) + buffer += self.ic.commit_string() + if not ret: + buffer += str(i) + self.ic.flush() + buffer += self.ic.commit_string() + self.assertEqual(output, buffer) + +if __name__ == '__main__': + unittest.main() -- 2.7.4