Fix the python tests
- add correct rules for the composed unicode form
- add tests for the decomposed unicode form
diff --git a/python/tests/test.cti b/python/tests/test.cti
index 3dd5a2b..b0884ec 100644
--- a/python/tests/test.cti
+++ b/python/tests/test.cti
@@ -1,3 +1,6 @@
noback correct "\xd83d\xde02" "(face\swith\stears\sof\sjoy)"
noback correct "\xd83e\xdd23" "(rolling\son\sthe\sfloor\slaughing)"
noback correct "\xd83d\xde03" "(grinning\sface\swith\sbig\seyes)"
+noback correct "\y1f602" "(face\swith\stears\sof\sjoy)"
+noback correct "\y1f923" "(rolling\son\sthe\sfloor\slaughing)"
+noback correct "\y1f602" "(grinning\sface\swith\sbig\seyes)"
diff --git a/python/tests/test_louis.py b/python/tests/test_louis.py
index 99c59f2..e55a128 100644
--- a/python/tests/test_louis.py
+++ b/python/tests/test_louis.py
@@ -1,62 +1,100 @@
import unittest
import louis
-class TestFaceWithTearsOfJoy(unittest.TestCase):
+class TestUnicodeComposed(unittest.TestCase):
@unittest.expectedFailure
def test_1(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "😂"),
- '<face with tears of joy>')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "😂"),
+ '"<face with tears of joy">')
- @unittest.expectedFailure
def test_2(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "a 😂"),
- 'a <face with tears of joy>')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a 😂"),
+ 'a "<face with tears of joy">')
- @unittest.expectedFailure
def test_3(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "😂 b"),
- '<face with tears of joy> b')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "😂 b"),
+ '"<face with tears of joy"> b')
- @unittest.expectedFailure
def test_4(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "a 😂 b"),
- 'a <face with tears of joy> b')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a 😂 b"),
+ 'a "<face with tears of joy"> b')
- @unittest.expectedFailure
def test_8(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "before 😂"),
- 'before <face with tears of joy>')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "before 😂"),
+ 'before "<face with tears of joy">')
- @unittest.expectedFailure
def test_9(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "😂 after"),
- '<face with tears of joy> after')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "😂 after"),
+ '"<face with tears of joy"> after')
- @unittest.expectedFailure
def test_10(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "before 😂 after"),
- 'before <face with tears of joy> after')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "before 😂 after"),
+ 'before "<face with tears of joy"> after')
@unittest.expectedFailure
def test_11(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "🤣"),
- '<rolling on the floor laughing>')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "🤣"),
+ '"<rolling on the floor laughing">')
- @unittest.expectedFailure
def test_12(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "a 🤣"),
- 'a <rolling on the floor laughing>')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a 🤣"),
+ 'a "<rolling on the floor laughing">')
- @unittest.expectedFailure
def test_13(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "🤣 b"),
- '<rolling on the floor laughing> b')
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "🤣 b"),
+ '"<rolling on the floor laughing"> b')
+
+ def test_14(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a 🤣 b"),
+ 'a "<rolling on the floor laughing"> b')
+
+class TestUnicodeDecomposed(unittest.TestCase):
@unittest.expectedFailure
- def test_14(self):
- self.assertEqual(louis.translateString(["en-us-g2.ctb", "tests/test.cti"], "a 🤣 b"),
- 'a <rolling on the floor laughing> b')
+ def test_1(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83d\ude02"),
+ '"<face with tears of joy">')
+ def test_2(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a \ud83d\ude02"),
+ 'a "<face with tears of joy">')
+
+ def test_3(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83d\ude02 b"),
+ '"<face with tears of joy"> b')
+
+ def test_4(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a \ud83d\ude02 b"),
+ 'a "<face with tears of joy"> b')
+
+ def test_8(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "before \ud83d\ude02"),
+ 'before "<face with tears of joy">')
+
+ def test_9(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83d\ude02 after"),
+ '"<face with tears of joy"> after')
+
+ def test_10(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "before \ud83d\ude02 after"),
+ 'before "<face with tears of joy"> after')
+
+ @unittest.expectedFailure
+ def test_11(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83e\udd23"),
+ '"<rolling on the floor laughing">')
+
+ def test_12(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a \ud83e\udd23"),
+ 'a "<rolling on the floor laughing">')
+
+ def test_13(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83e\udd23 b"),
+ '"<rolling on the floor laughing"> b')
+
+ def test_14(self):
+ self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a \ud83e\udd23 b"),
+ 'a "<rolling on the floor laughing"> b')
if __name__ == '__main__':
unittest.main()