Best Python code snippet using lemoncheesecake
console.py
Source:console.py  
...49        self.highlight = highlight50        self.show_debug_logs = show_debug_logs51        # "20" is an approximation of the maximal overhead of table border, padding, and table first cell52        self._table_overhead = 2053    def wrap_description_col(self, description):54        return wrap_text(description, int((self.max_width - self._table_overhead) * 0.75))55    def wrap_details_col(self, details):56        return wrap_text(details, int((self.max_width - self._table_overhead) * 0.25))57    def render_check_outcome(self, is_successful):58        if self.explicit:59            check_label = "CHECK %s" % ("OK" if is_successful else "KO")60        else:61            check_label = "CHECK"62        return colored(check_label, color=outcome_to_color(is_successful), attrs=["bold"])63    def render_highlighted(self, content):64        if not self.highlight or not content:65            return content66        return self.highlight.sub(67            lambda m: colored(m.group(0), color="yellow", attrs=["bold", "underline"]), content68        )69    def render_step_log(self, log):70        if isinstance(log, Log):71            if log.level == "debug" and not self.show_debug_logs:72                return None73            else:74                return [75                    colored(log.level.upper(), color=log_level_to_color(log.level), attrs=["bold"]),76                    self.render_highlighted(self.wrap_description_col(log.message))77                ]78        if isinstance(log, Check):79            return [80                self.render_check_outcome(log.is_successful),81                self.render_highlighted(self.wrap_description_col(log.description)),82                self.render_highlighted(self.wrap_details_col(log.details))83            ]84        if isinstance(log, Url):85            if log.description == log.url:86                description = log.url87            else:88                description = "%s (%s)" % (log.url, log.description)89            return [90                colored("URL", color="cyan", attrs=["bold"]),91                self.render_highlighted(self.wrap_description_col(description))92            ]93        if isinstance(log, Attachment):94            return [95                colored("ATTACH", color="cyan", attrs=["bold"]),96                self.render_highlighted(self.wrap_description_col(log.description)),97                self.render_highlighted(log.filename)98            ]99        raise ValueError("Unknown step log class '%s'" % log.__class__.__name__)100    def render_steps(self, steps):101        rows = []102        for step in steps:103            step_log_rows = list(filter(bool, map(self.render_step_log, step.get_logs())))104            if step_log_rows:105                rows.append([106                    "",107                    colored(108                        self.render_highlighted(self.wrap_description_col(step.description)),109                        color=outcome_to_color(step.is_successful()),110                        attrs=["bold"]111                    ),112                    colored(humanize_duration(step.duration, show_milliseconds=True), attrs=["bold"])113                        if step.duration is not None else "-"114                ])115                rows.extend(step_log_rows)116        if not rows:117            return None118        table = AsciiTable(rows)119        table.inner_heading_row_border = False120        table.justify_columns[0] = "center"121        table.inner_row_border = True122        return table.table...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
