summaryrefslogtreecommitdiff
path: root/bindings/python/test_pyhangul.py
blob: 52a6548f2e7ae666886c5ceb4a1ecd4b8b82930b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# coding: utf-8
#
# Author: Gyoung-Yoon Noh <nohmad@gmail.com>
# License: Same as libhangul.

import sys
import hangul
import unittest

class TestHangul(unittest.TestCase):
    def setUp(self):
        self.ic = hangul.create_ic('2')

    def testSimpleString(self):
        input  = u"vkdlTjs gksrmf fkdlqmfjfl xptmxm"
        output = u"파이썬 한글 라이브러리 테스트"
        buffer = u''
        for i in input:
            ret = self.ic.process(ord(i))
            buffer += self.ic.commit_string()
            if not ret:
                buffer += str(i)
        buffer += self.ic.flush()
        buffer += self.ic.commit_string()
        self.assertEqual(output, buffer)

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