MCPcopy Index your code
hub / github.com/lincolnloop/python-qrcode / test_stdin_py3_unicodedecodeerror

Function test_stdin_py3_unicodedecodeerror

qrcode/tests/test_script.py:37–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35
36@mock.patch("os.isatty", lambda *args: True)
37def test_stdin_py3_unicodedecodeerror():
38 with mock.patch("qrcode.main.QRCode.print_ascii") as mock_print_ascii:
39 with mock.patch("sys.stdin") as mock_stdin:
40 mock_stdin.buffer.read.return_value = "testtext"
41 mock_stdin.read.side_effect = bad_read
42 # sys.stdin.read() will raise an error...
43 with pytest.raises(UnicodeDecodeError):
44 sys.stdin.read()
45 # ... but it won't be used now.
46 main([])
47 mock_print_ascii.assert_called_with(tty=True)
48
49
50def test_optimize():

Callers

nothing calls this directly

Calls 1

mainFunction · 0.90

Tested by

no test coverage detected