def test_addSkipped(self): # Calling addSkip on a TestResult records the test that was skipped in # its skip_reasons dict. result = self.makeResult() result.addSkip(self, _u("Skipped for some reason")) self.assertEqual({_u("Skipped for some reason"):[self]}, result.skip_reasons) result.addSkip(self, _u("Skipped for some reason")) self.assertEqual({_u("Skipped for some reason"):[self, self]}, result.skip_reasons) result.addSkip(self, _u("Skipped for another reason")) self.assertEqual({_u("Skipped for some reason"):[self, self], _u("Skipped for another reason"):[self]}, result.skip_reasons)
def test_forwarding_methods(self): # error, failure, skip and success are forwarded in batches. exc_info1 = self.makeExceptionInfo(RuntimeError, 'error') self.result1.addError(self, exc_info1) exc_info2 = self.makeExceptionInfo(AssertionError, 'failure') self.result1.addFailure(self, exc_info2) reason = _u("Skipped for some reason") self.result1.addSkip(self, reason) self.result1.addSuccess(self) self.assertEqual([('startTest', self), ('addError', self, exc_info1), ('stopTest', self), ('startTest', self), ('addFailure', self, exc_info2), ('stopTest', self), ('startTest', self), ('addSkip', self, reason), ('stopTest', self), ('startTest', self), ('addSuccess', self), ('stopTest', self), ], self.target._events)
def test_addSkipped(self): # Calling addSkip(test, reason) completes ok. result = self.makeResult() result.addSkip(self, _u("Skipped for some reason"))
def test_addSkipped(self): # Calling `addSkip` on a `MultiTestResult` calls addSkip on its # results. reason = _u("Skipped for some reason") self.multiResult.addSkip(self, reason) self.assertResultLogsEqual([('addSkip', self, reason)])
def test_iter_text_default_charset_iso_8859_1(self): content_type = ContentType("text", "strange") text = _u("bytes\xea") iso_version = text.encode("ISO-8859-1") content = Content(content_type, lambda: [iso_version]) self.assertEqual([text], list(content.iter_text()))
def test_iter_text_decodes(self): content_type = ContentType("text", "strange", {"charset": "utf8"}) content = Content(content_type, lambda: [_u("bytes\xea").encode("utf8")]) self.assertEqual([_u("bytes\xea")], list(content.iter_text()))