Skip to content

Commit 281a49e

Browse files
committed
Fix for Python 2.7
1 parent 4ab3502 commit 281a49e

File tree

6 files changed

+27
-4
lines changed

6 files changed

+27
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
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+
25
Reconstruct Arabic sentences to be used in applications that don't support
36
Arabic script.
47

arabic_reshaper/letters.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
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+
1618
ISOLATED = 0
1719
INITIAL = 1
1820
MEDIAL = 2

arabic_reshaper/ligatures.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
# 3. Letters
2020
# This way we make sure we replace the longest ligatures first
2121

22+
from __future__ import unicode_literals
23+
2224
LIGATURES = (
2325
# Sentences
2426
('ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM', (

arabic_reshaper/tests/test_001_initialization.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import unicode_literals
2+
13
import unittest
24
import 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])

arabic_reshaper/tests/test_002_reshaping.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# -*- coding: utf-8 -*-
22

3+
from __future__ import unicode_literals
4+
35
import unittest
46
import 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

3543
if __name__ == '__main__':

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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'],

0 commit comments

Comments
 (0)