def test_assertion_text_shift_jis(self): """A terminal raw backslash in an encoded string is weird but fine""" example_text = _u("\u5341") textoutput = self._test_external_case( coding="shift_jis", testline="self.fail('%s')" % example_text) if str_is_unicode: output_text = example_text else: output_text = example_text.encode("shift_jis").decode( _get_exception_encoding(), "replace") self.assertIn(self._as_output("AssertionError: %s" % output_text), textoutput)
def test_non_ascii_failure_string_via_exec(self): """Assertion via exec can be non-ascii and still gets decoded""" text, raw = self._get_sample_text(_get_exception_encoding()) textoutput = self._test_external_case( testline='exec ("self.fail(%s)")' % _r(raw)) self.assertIn(self._as_output(text), textoutput)
def test_non_ascii_failure_string(self): """Assertion contents can be non-ascii and should get decoded""" text, raw = self._get_sample_text(_get_exception_encoding()) textoutput = self._test_external_case("self.fail(%s)" % _r(raw)) self.assertIn(self._as_output(text), textoutput)