summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_getpass.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-04-14 02:09:29 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-04-14 02:09:29 (GMT)
commite084e97f9f502908534bc87596c5bb7b6ff9a684 (patch)
tree687757481ac5041a7a7b8656cda4a8f51ba86b32 /Lib/test/test_getpass.py
parentfc8e9883bef8058723a38f6c8db6549ad611a633 (diff)
parentd5aa487cceac54fdf2b5c073157b899b3c8c9c94 (diff)
downloadcpython-e084e97f9f502908534bc87596c5bb7b6ff9a684.zip
cpython-e084e97f9f502908534bc87596c5bb7b6ff9a684.tar.gz
cpython-e084e97f9f502908534bc87596c5bb7b6ff9a684.tar.bz2
Mierge #21169: fix getpass to use replace error handler on UnicodeEncodeError.
Diffstat (limited to 'Lib/test/test_getpass.py')
-rw-r--r--Lib/test/test_getpass.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_getpass.py b/Lib/test/test_getpass.py
index 1731bd4..3452e46 100644
--- a/Lib/test/test_getpass.py
+++ b/Lib/test/test_getpass.py
@@ -1,7 +1,7 @@
import getpass
import os
import unittest
-from io import BytesIO, StringIO
+from io import BytesIO, StringIO, TextIOWrapper
from unittest import mock
from test import support
@@ -69,6 +69,14 @@ class GetpassRawinputTest(unittest.TestCase):
getpass._raw_input(stream=StringIO())
mock_input.readline.assert_called_once_with()
+ @mock.patch('sys.stdin')
+ def test_uses_stdin_as_different_locale(self, mock_input):
+ stream = TextIOWrapper(BytesIO(), encoding="ascii")
+ mock_input.readline.return_value = "Hasło: "
+ getpass._raw_input(prompt="Hasło: ",stream=stream)
+ mock_input.readline.assert_called_once_with()
+
+
def test_raises_on_empty_input(self):
input = StringIO('')
self.assertRaises(EOFError, getpass._raw_input, input=input)