MCPcopy Index your code
hub / github.com/python/cpython / test_unicode_error

Method test_unicode_error

Lib/test/test_code_module.py:130–141  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

128 self.assertIs(self.sysmod.last_exc, self.sysmod.last_value)
129
130 def test_unicode_error(self):
131 self.infunc.side_effect = ["'\ud800'", EOFError('Finished')]
132 self.console.interact()
133 output = ''.join(''.join(call[1]) for call in self.stderr.method_calls)
134 output = output[output.index('(InteractiveConsole)'):]
135 output = output[output.index('\n') + 1:]
136 self.assertStartsWith(output, 'UnicodeEncodeError: ')
137 self.assertIs(self.sysmod.last_type, UnicodeEncodeError)
138 self.assertIs(type(self.sysmod.last_value), UnicodeEncodeError)
139 self.assertIsNone(self.sysmod.last_traceback)
140 self.assertIsNone(self.sysmod.last_value.__traceback__)
141 self.assertIs(self.sysmod.last_exc, self.sysmod.last_value)
142
143 def test_sysexcepthook(self):
144 self.infunc.side_effect = ["def f():",

Callers

nothing calls this directly

Calls 6

assertStartsWithMethod · 0.80
assertIsNoneMethod · 0.80
interactMethod · 0.45
joinMethod · 0.45
indexMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected