<commit_before>from behave.formatter.base import Formatter


class PlainFormatter(Formatter):
    name = 'plain'
    description = 'Very basic formatter with maximum compatibility'

    def __init__(self, stream, config):
        super(PlainFormatter, self).__init__(stream, config)
        self.steps = []

    def feature(self, feature):
        self.stream.write(u'%s: %s\n' % (feature.keyword, feature.name))

    def background(self, background):
        self.stream.write(u'%s: %s\n' % (background.keyword, background.name))

    def scenario(self, scenario):
        self.stream.write(u'%11s: %s\n' % (scenario.keyword, scenario.name))

    def scenario_outline(self, outline):
        self.stream.write(u' %s: %s\n' % (outline.keyword, outline.name))

    def step(self, step):
        self.steps.append(step)

    def result(self, result):
        step = self.steps.pop(0)
        # TODO right-align the keyword to maximum keyword width?
        self.stream.write(u'%12s %s ... ' % (step.keyword, step.name))
        if result.error_message:
            self.stream.write(u'%s: %s\n' % (result.status, result.error_message))
        else:<commit_msg>With plain format, print the error messages to a different when a step fails.<commit_after>from behave.formatter.base import Formatter


class PlainFormatter(Formatter):
    name = 'plain'
    description = 'Very basic formatter with maximum compatibility'

    def __init__(self, stream, config):
        super(PlainFormatter, self).__init__(stream, config)
        self.steps = []

    def feature(self, feature):
        self.stream.write(u'%s: %s\n' % (feature.keyword, feature.name))

    def background(self, background):
        self.stream.write(u'%s: %s\n' % (background.keyword, background.name))

    def scenario(self, scenario):
        self.stream.write(u'%11s: %s\n' % (scenario.keyword, scenario.name))

    def scenario_outline(self, outline):
        self.stream.write(u' %s: %s\n' % (outline.keyword, outline.name))

    def step(self, step):
        self.steps.append(step)

    def result(self, result):
        step = self.steps.pop(0)
        # TODO right-align the keyword to maximum keyword width?
        self.stream.write(u'%12s %s ... ' % (step.keyword, step.name))
        if result.error_message:
            self.stream.write(u'%s\n%s\n' % (result.status, result.error_message))
        else:
{'fraction_non_alphanumeric': 0.14021830394626364, 'fraction_numerical': 0.0041981528127623844, 'mean_word_length': 3.032148900169205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3068348', 'n_tokens_mistral': 758, 'n_tokens_neox': 733, 'n_words': 171}