third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py
def add_expectations(self, path, exps, lineno=0, append_to_end_of_file=False):
        """This method adds Expectation instances to an expectations file. It will
        add the new instances after the line number passed through the lineno parameter.
        If the lineno is set to a value outside the range of line numbers in the file
        then it will append the expectations to the end of the file

        args:
            path: Absolute path of file where expectations will be added to.
            exps: List of Expectation instances to be added to the file.
            lineno: Line number in expectations file where the expectations will
                    be added."""
        idx = list(self._expectations_dict.keys()).index(path)
        typ_expectations = self._expectations[idx]
        added_glob = False

        if lineno < 0:
            raise ValueError('lineno cannot be negative.')
        if (append_to_end_of_file and lineno or
                not append_to_end_of_file and not lineno):
            raise ValueError('If append_to_end_of_file is set then lineno '
                             'must be 0. Also if lineno is 0 then '
                             'append_to_end_of_file must be set to True.')

        for exp in exps:
            exp.lineno = lineno

        for exp in exps:
            added_glob |= exp.is_glob
            if exp.is_glob:
                typ_expectations.glob_exps.setdefault(exp.test, []).append(exp)
            else:
                typ_expectations.individual_exps.setdefault(exp.test,
                                                            []).append(exp)

        if added_glob:
            glob_exps = reduce(lambda x, y: x + y,
                               list(typ_expectations.glob_exps.values()))
            glob_exps.sort(key=lambda e: len(e.test), reverse=True)
            typ_expectations.glob_exps = OrderedDict()
            for exp in glob_exps:
                typ_expectations.glob_exps.setdefault(exp.test, []).append(exp)
This method adds Expectation instances to an expectations file. It will
        add the new instances after the line number passed through the lineno parameter.
        If the lineno is set to a value outside the range of line numbers in the file
        then it will append the expectations to the end of the file

        args:
            path: Absolute path of file where expectations will be added to.
            exps: List of Expectation instances to be added to the file.
            lineno: Line number in expectations file where the expectations will
                    be added.
This method adds Expectation instances to an expectations file. It will
add the new instances after the line number passed through the lineno parameter.
If the lineno is set to a value outside the range of line numbers in the file
then it will append the expectations to the end of the file

Absolute path of file where expectations will be added to.
exps: List of Expectation instances to be added to the file.
lineno: Line number in expectations file where the expectations will
be added.
This method adds Expectation instances to an expectations file . It will add the new instances after the line number passed through the lineno parameter . If the lineno is set to a value outside the range of line numbers in the file then it will append the expectations to the end of the file Absolute path of file where expectations will be added to . exps : List of Expectation instances to be added to the file . lineno : Line number in expectations file where the expectations will be added .
def add_expectations(self, path, exps, lineno=0, append_to_end_of_file=False):
        idx = list(self._expectations_dict.keys()).index(path)
        typ_expectations = self._expectations[idx]
        added_glob = False
        if lineno < 0:
            raise ValueError('lineno cannot be negative.')
        if (append_to_end_of_file and lineno or
                not append_to_end_of_file and not lineno):
            raise ValueError('If append_to_end_of_file is set then lineno '
                             'must be 0. Also if lineno is 0 then '
                             'append_to_end_of_file must be set to True.')
        for exp in exps:
            exp.lineno = lineno
        for exp in exps:
            added_glob |= exp.is_glob
            if exp.is_glob:
                typ_expectations.glob_exps.setdefault(exp.test, []).append(exp)
            else:
                typ_expectations.individual_exps.setdefault(exp.test,
                                                            []).append(exp)
        if added_glob:
            glob_exps = reduce(lambda x, y: x + y,
                               list(typ_expectations.glob_exps.values()))
            glob_exps.sort(key=lambda e: len(e.test), reverse=True)
            typ_expectations.glob_exps = OrderedDict()
            for exp in glob_exps:
                typ_expectations.glob_exps.setdefault(exp.test, []).append(exp)
def add_expectations ( self , path , exps , lineno = 0 , append_to_end_of_file = False ) : idx = list ( self . _expectations_dict . keys ( ) ) . index ( path ) typ_expectations = self . _expectations [ idx ] added_glob = False if lineno < 0 : raise ValueError ( 'lineno cannot be negative.' ) if ( append_to_end_of_file and lineno or not append_to_end_of_file and not lineno ) : raise ValueError ( 'If append_to_end_of_file is set then lineno ' 'must be 0. Also if lineno is 0 then ' 'append_to_end_of_file must be set to True.' ) for exp in exps : exp . lineno = lineno for exp in exps : added_glob |= exp . is_glob if exp . is_glob : typ_expectations . glob_exps . setdefault ( exp . test , [ ] ) . append ( exp ) else : typ_expectations . individual_exps . setdefault ( exp . test , [ ] ) . append ( exp ) if added_glob : glob_exps = reduce ( lambda x , y : x + y , list ( typ_expectations . glob_exps . values ( ) ) ) glob_exps . sort ( key = lambda e : len ( e . test ) , reverse = True ) typ_expectations . glob_exps = OrderedDict ( ) for exp in glob_exps : typ_expectations . glob_exps . setdefault ( exp . test , [ ] ) . append ( exp )
This method adds Expectation instances to an expectations file.
This method adds Expectation instances to an expectations file .
"""This method adds Expectation instances to an expectations file. It will
        add the new instances after the line number passed through the lineno parameter.
        If the lineno is set to a value outside the range of line numbers in the file
        then it will append the expectations to the end of the file

        args:
            path: Absolute path of file where expectations will be added to.
            exps: List of Expectation instances to be added to the file.
            lineno: Line number in expectations file where the expectations will
                    be added."""
self
path
exps
lineno
append_to_end_of_file