Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 1 | import unittest |
| 2 | import louis |
| 3 | |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 4 | class TestUnicodeComposed(unittest.TestCase): |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 5 | |
| 6 | @unittest.expectedFailure |
| 7 | def test_1(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 8 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "😂"), |
| 9 | '"<face with tears of joy">') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 10 | |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 11 | def test_2(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 12 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a 😂"), |
| 13 | 'a "<face with tears of joy">') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 14 | |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 15 | def test_3(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 16 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "😂 b"), |
| 17 | '"<face with tears of joy"> b') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 18 | |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 19 | def test_4(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 20 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a 😂 b"), |
| 21 | 'a "<face with tears of joy"> b') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 22 | |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 23 | def test_8(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 24 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "before 😂"), |
| 25 | 'before "<face with tears of joy">') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 26 | |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 27 | def test_9(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 28 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "😂 after"), |
| 29 | '"<face with tears of joy"> after') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 30 | |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 31 | def test_10(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 32 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "before 😂 after"), |
| 33 | 'before "<face with tears of joy"> after') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 34 | |
| 35 | @unittest.expectedFailure |
| 36 | def test_11(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 37 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "🤣"), |
| 38 | '"<rolling on the floor laughing">') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 39 | |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 40 | def test_12(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 41 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a 🤣"), |
| 42 | 'a "<rolling on the floor laughing">') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 43 | |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 44 | def test_13(self): |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 45 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "🤣 b"), |
| 46 | '"<rolling on the floor laughing"> b') |
| 47 | |
| 48 | def test_14(self): |
| 49 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a 🤣 b"), |
| 50 | 'a "<rolling on the floor laughing"> b') |
| 51 | |
| 52 | class TestUnicodeDecomposed(unittest.TestCase): |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 53 | |
| 54 | @unittest.expectedFailure |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 55 | def test_1(self): |
| 56 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83d\ude02"), |
| 57 | '"<face with tears of joy">') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 58 | |
Christian Egli | 6cb7ab6 | 2021-05-27 10:33:50 +0200 | [diff] [blame] | 59 | def test_2(self): |
| 60 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a \ud83d\ude02"), |
| 61 | 'a "<face with tears of joy">') |
| 62 | |
| 63 | def test_3(self): |
| 64 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83d\ude02 b"), |
| 65 | '"<face with tears of joy"> b') |
| 66 | |
| 67 | def test_4(self): |
| 68 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a \ud83d\ude02 b"), |
| 69 | 'a "<face with tears of joy"> b') |
| 70 | |
| 71 | def test_8(self): |
| 72 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "before \ud83d\ude02"), |
| 73 | 'before "<face with tears of joy">') |
| 74 | |
| 75 | def test_9(self): |
| 76 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83d\ude02 after"), |
| 77 | '"<face with tears of joy"> after') |
| 78 | |
| 79 | def test_10(self): |
| 80 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "before \ud83d\ude02 after"), |
| 81 | 'before "<face with tears of joy"> after') |
| 82 | |
| 83 | @unittest.expectedFailure |
| 84 | def test_11(self): |
| 85 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83e\udd23"), |
| 86 | '"<rolling on the floor laughing">') |
| 87 | |
| 88 | def test_12(self): |
| 89 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a \ud83e\udd23"), |
| 90 | 'a "<rolling on the floor laughing">') |
| 91 | |
| 92 | def test_13(self): |
| 93 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "\ud83e\udd23 b"), |
| 94 | '"<rolling on the floor laughing"> b') |
| 95 | |
| 96 | def test_14(self): |
| 97 | self.assertEqual(louis.translateString(["en-ueb-g1.ctb", "tests/test.cti"], "a \ud83e\udd23 b"), |
| 98 | 'a "<rolling on the floor laughing"> b') |
Christian Egli | b7d53da | 2021-05-26 16:35:52 +0200 | [diff] [blame] | 99 | if __name__ == '__main__': |
| 100 | unittest.main() |