def test_it_colors_example_names_blue_in_tracebacks(self): example = mock.MagicMock() example.__str__.return_value = "Example" example.group.__str__.return_value = "Thing" traceback = "The\nTraceback\n" name = self.colored.color("blue", "Thing: Example") self.assertEqual( self.colored.traceback(example, traceback), indent(name + "\n" + traceback, 4 * " "), )
def success(self, example): return indent(str(example), 4 * " ") + "\n"
def failure(self, example, exc_info): return indent(str(example), 4 * " ") + " - FAIL\n"
def error(self, example, exc_info): return indent(str(example), 4 * " ") + " - ERROR\n"
def traceback(self, example, traceback): name = str(example.group) + ": " + str(example) colored = "\n".join([self.color("blue", name), traceback]) return indent(colored, 4 * " ")
def success(self, example): return indent(str(example), self._depth * 4 * " ") + "\n"
def enter_context(self, context, depth): self._depth = depth + 1 return indent(context.name + "\n", depth * 4 * " ")