|
1 | 1 | # coding: utf8 |
| 2 | +from __future__ import unicode_literals |
| 3 | + |
2 | 4 | import code |
3 | 5 | from contextlib import contextmanager |
4 | 6 | from mock import Mock, patch, MagicMock |
@@ -53,13 +55,14 @@ def test_code_finished_will_parse(self): |
53 | 55 | self.assertTrue(self.cfwp('\n'.join(self.repl.buffer)), (True, True)) |
54 | 56 |
|
55 | 57 | def test_external_communication(self): |
56 | | - self.assertEqual(type(self.repl.help_text()), type(b'')) |
57 | 58 | self.repl.send_current_block_to_external_editor() |
58 | 59 | self.repl.send_session_to_external_editor() |
59 | 60 |
|
| 61 | + @unittest.skipIf(not all(map(config.can_encode, 'å∂߃')), |
| 62 | + 'Charset can not encode characters') |
60 | 63 | def test_external_communication_encoding(self): |
61 | 64 | with captured_output(): |
62 | | - self.repl.display_lines.append(u'>>> "åß∂ƒ"') |
| 65 | + self.repl.display_lines.append('>>> "åß∂ƒ"') |
63 | 66 | self.repl.send_session_to_external_editor() |
64 | 67 |
|
65 | 68 | def test_get_last_word(self): |
@@ -269,19 +272,23 @@ class TestCurtsiesPagerText(TestCase): |
269 | 272 |
|
270 | 273 | def setUp(self): |
271 | 274 | self.repl = create_repl() |
272 | | - self.repl.pager = self.assert_pager_gets_bytes |
| 275 | + self.repl.pager = self.assert_pager_gets_unicode |
273 | 276 |
|
274 | | - def assert_pager_gets_bytes(self, text): |
275 | | - self.assertIsInstance(text, type(b'')) |
| 277 | + def assert_pager_gets_unicode(self, text): |
| 278 | + self.assertIsInstance(text, type('')) |
276 | 279 |
|
277 | 280 | def test_help(self): |
278 | 281 | self.repl.pager(self.repl.help_text()) |
279 | 282 |
|
| 283 | + @unittest.skipIf(not all(map(config.can_encode, 'å∂߃')), |
| 284 | + 'Charset can not encode characters') |
280 | 285 | def test_show_source_not_formatted(self): |
281 | 286 | self.repl.config.highlight_show_source = False |
282 | 287 | self.repl.get_source_of_current_name = lambda: 'source code å∂߃åß∂ƒ' |
283 | 288 | self.repl.show_source() |
284 | 289 |
|
| 290 | + @unittest.skipIf(not all(map(config.can_encode, 'å∂߃')), |
| 291 | + 'Charset can not encode characters') |
285 | 292 | def test_show_source_formatted(self): |
286 | 293 | self.repl.config.highlight_show_source = True |
287 | 294 | self.repl.get_source_of_current_name = lambda: 'source code å∂߃åß∂ƒ' |
|
0 commit comments