#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import unittest

sys.path.append('..')
import basehangul

class test_BaseHangul(unittest.TestCase):
    TEXT_ORIGINAL = 'This is an encoded string'
    TEXT_ENCODED = u'넥라똔먈늴멥갯놓궂뗐밸뮤뉴뗐뀄굡덜멂똑뚤'

    def setUp(self):
        pass

    def test_empty(self):
        encoded = basehangul.encode('')
        self.assertEqual(encoded, '')

    def test_encode(self):
        encoded = basehangul.encode(self.TEXT_ORIGINAL)
        self.assertEqual(encoded, self.TEXT_ENCODED)

    def test_decode(self):
        decoded = basehangul.decode(self.TEXT_ENCODED)
        self.assertEqual(decoded, self.TEXT_ORIGINAL)

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

@@ -160,22 +160,30 @@
   TE
-XT_ORIGINAL = 
+ST_CASES = (%0A        (
 'Thi
@@ -209,27 +209,9 @@
 ing'
-%0A    TEXT_ENCODED =
+,
  u'%EB%84%A5
@@ -230,16 +230,266 @@
 %EB%97%90%EB%80%84%EA%B5%A1%EB%8D%9C%EB%A9%82%EB%98%91%EB%9A%A4'
+),%0A        ('123ab', u'%EA%BA%BD%EB%A8%B9%EA%BC%8D%EB%85%9C'),%0A        ('123d%5Cx00', u'%EA%BA%BD%EB%A8%B9%EA%BC%90%EA%B0%80'),%0A        ('1', u'%EA%BA%BD%ED%9D%90%ED%9D%90%ED%9D%90'),%0A        ('12', u'%EA%BA%BD%EB%A8%88%ED%9D%90%ED%9D%90'),%0A        ('123', u'%EA%BA%BD%EB%A8%B9%EA%BA%84%ED%9D%90'),%0A        ('123d', u'%EA%BA%BD%EB%A8%B9%EA%BC%90%EB%B9%8E'),%0A        ('123e', u'%EA%BA%BD%EB%A8%B9%EA%BC%90%EB%B9%94'),%0A        ('123f', u'%EA%BA%BD%EB%A8%B9%EA%BC%90%EB%B9%95'),%0A        ('123g', u'%EA%BA%BD%EB%A8%B9%EA%BC%90%EB%B9%97'),%0A    )
 %0A%0A    de
@@ -641,32 +641,77 @@
 t_encode(self):%0A
+        for enc, dec in self.TEST_CASES:%0A    
         encoded 
@@ -730,36 +730,25 @@
 .encode(
-self.TEXT_ORIGINAL)%0A
+enc)%0A    
         
@@ -773,33 +773,19 @@
 ncoded, 
-self.TEXT_ENCODED
+dec
 )%0A%0A    d
@@ -798,32 +798,77 @@
 t_decode(self):%0A
+        for enc, dec in self.TEST_CASES:%0A    
         decoded 
@@ -891,27 +891,17 @@
 ode(
-self.TEXT_ENCODED)%0A
+dec)%0A    
     
@@ -934,26 +934,11 @@
 ed, 
-self.TEXT_ORIGINAL
+enc
 )%0A%0Ai

add more test scripts