lbry-android-sdk/p4a/tests/test_logger.py

19 lines
640 B
Python
Raw Normal View History

2022-11-29 21:35:24 +01:00
import unittest
from unittest.mock import MagicMock
from pythonforandroid import logger
class TestShprint(unittest.TestCase):
def test_unicode_encode(self):
"""
Makes sure `shprint()` can handle unicode command output.
Running the test with PYTHONIOENCODING=ASCII env would fail, refs:
https://github.com/kivy/python-for-android/issues/1654
"""
expected_command_output = ["foo\xa0bar"]
command = MagicMock()
command.return_value = expected_command_output
output = logger.shprint(command, 'a1', k1='k1')
self.assertEqual(output, expected_command_output)