File: test_pyhangul.py

package info (click to toggle)
libhangul 0.1.0%2Bgit20170815-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,376 kB
  • sloc: ansic: 8,295; python: 627; xml: 394; makefile: 164; ruby: 24; sh: 12
file content (28 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (2)
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('hangul2')

    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()