File tree Expand file tree Collapse file tree 6 files changed +27
-4
lines changed
Expand file tree Collapse file tree 6 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 11## Python Arabic Reshaper
2+
3+ [ ![ Build Status] ( https://travis-ci.org/mpcabd/python-arabic-reshaper.svg?branch=master )] ( https://travis-ci.org/mpcabd/python-arabic-reshaper )
4+
25Reconstruct Arabic sentences to be used in applications that don't support
36Arabic script.
47
Original file line number Diff line number Diff line change 1313# <letter> should be in final form. If no replacement is specified for a form,
1414# then no that means the letter doesn't support this form.
1515
16+ from __future__ import unicode_literals
17+
1618ISOLATED = 0
1719INITIAL = 1
1820MEDIAL = 2
Original file line number Diff line number Diff line change 1919# 3. Letters
2020# This way we make sure we replace the longest ligatures first
2121
22+ from __future__ import unicode_literals
23+
2224LIGATURES = (
2325 # Sentences
2426 ('ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM' , (
Original file line number Diff line number Diff line change 1+ from __future__ import unicode_literals
2+
13import unittest
24import arabic_reshaper
35
@@ -29,7 +31,13 @@ def test_delete_harakat(self):
2931 def test_ligatures (self ):
3032 import arabic_reshaper .ligatures
3133 for ligature in arabic_reshaper .ligatures .LIGATURES :
32- with self .subTest (ligature = ligature [0 ]):
34+ if hasattr (self , 'subTest' ):
35+ with self .subTest (ligature = ligature [0 ]):
36+ self .assertIn (ligature [0 ], self .reshaper .configuration )
37+ self .assertIsNotNone (
38+ self .reshaper .configuration .getboolean (ligature [0 ])
39+ )
40+ else :
3341 self .assertIn (ligature [0 ], self .reshaper .configuration )
3442 self .assertIsNotNone (
3543 self .reshaper .configuration .getboolean (ligature [0 ])
Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22
3+ from __future__ import unicode_literals
4+
35import unittest
46import arabic_reshaper
57
@@ -14,7 +16,10 @@ def setUp(self):
1416
1517 def test_reshaping (self ):
1618 for i , case in enumerate (self .cases ):
17- with self .subTest (i = i , case = case [0 ]):
19+ if hasattr (self , 'subTest' ):
20+ with self .subTest (i = i , case = case [0 ]):
21+ self .assertEqual (case [1 ], self .reshaper .reshape (case [0 ]))
22+ else :
1823 self .assertEqual (case [1 ], self .reshaper .reshape (case [0 ]))
1924
2025
@@ -29,7 +34,10 @@ def setUp(self):
2934
3035 def test_reshaping (self ):
3136 for i , case in enumerate (self .cases ):
32- with self .subTest (i = i , case = case [0 ]):
37+ if hasattr (self , 'subTest' ):
38+ with self .subTest (i = i , case = case [0 ]):
39+ self .assertEqual (case [1 ], self .reshaper .reshape (case [0 ]))
40+ else :
3341 self .assertEqual (case [1 ], self .reshaper .reshape (case [0 ]))
3442
3543if __name__ == '__main__' :
Original file line number Diff line number Diff line change 77 name = "arabic_reshaper" ,
88 description = ("Reconstruct Arabic sentences to be used in"
99 " applications that don't support Arabic" ),
10- version = '2.0.6 ' ,
10+ version = '2.0.7 ' ,
1111 platforms = "ALL" ,
1212 license = "GPL" ,
1313 packages = ['arabic_reshaper' ],
You can’t perform that action at this time.
0 commit comments