File: test_001_initialization.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 (43 lines) | stat: -rw-r--r-- 1,336 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
41
42
43
import unittest
import arabic_reshaper
import arabic_reshaper.ligatures


class TestDefaultConfiguration(unittest.TestCase):
    def setUp(self):
        self.reshaper = arabic_reshaper.ArabicReshaper()

    def boolean_check(self, boolean):
        self.assertIn(boolean, self.reshaper.configuration)
        self.assertIsNotNone(
            self.reshaper.configuration.getboolean(boolean)
        )

    def test_configuration_exists(self):
        self.assertIsNotNone(self.reshaper.configuration)

    def test_language(self):
        self.assertIn('language', self.reshaper.configuration)
        self.assertIsNotNone(self.reshaper.configuration['language'])
        self.assertTrue(self.reshaper.configuration['language'])

    def test_support_ligatures(self):
        self.boolean_check('support_ligatures')

    def test_delete_harakat(self):
        self.boolean_check('delete_harakat')

    def test_delete_tatweel(self):
        self.boolean_check('delete_tatweel')

    def test_ligatures(self):
        for ligature in arabic_reshaper.ligatures.LIGATURES:
            if hasattr(self, 'subTest'):
                with self.subTest(ligature=ligature[0]):
                    self.boolean_check(ligature[0])
            else:
                self.boolean_check(ligature[0])


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