File: test_003_reshaping.py

package info (click to toggle)
python-arabic-reshaper 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 276 kB
  • sloc: python: 2,030; makefile: 5
file content (40 lines) | stat: -rw-r--r-- 932 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-

import unittest
import sys
import arabic_reshaper
import arabic_reshaper.letters as letters


def _reshaping_test(test):
    for i, case in enumerate(test.cases):
        def t(): test.assertEqual(case[1], test.reshaper.reshape(case[0]))
        if hasattr(test, 'subTest'):
            with test.subTest(i=i, case=case[0]):

                t()
        else:
            print('running test case %d' % i, file=sys.stderr)
            t()


class TestDefaultReshaping(unittest.TestCase):
    def setUp(self):
        self.reshaper = arabic_reshaper.default_reshaper
        self.cases = (
            ('چۆمان','ﭼﯚﻣﺎﻥ'),
            ('گۆیژە','ﮔﯚﯾﮋە'),
            ('ﺧﯚﻣﺎﻥ ﺧﯚﺵ','ﺧﯚﻣﺎﻥ ﺧﯚﺵ'),


        )
        print(self.cases[0][0])

    def test_reshaping(self):
        _reshaping_test(self)




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