def contents(self, stream, expected, ordered=True):
name = stream.name + '<STR_LIT>'<EOL>if ordered:<EOL><INDENT>cond = sttrt._StreamContents(expected, name)<EOL>cond._desc = "<STR_LIT>".format(stream.name, expected)<EOL><DEDENT>else:<EOL><INDENT>cond = sttrt._UnorderedStreamContents(expected, name)<EOL>cond._desc = "<STR_LIT>".format(stream.name, expected)<EOL><DEDENT>return self.add_condition(stream, cond)<EOL>
Test that a stream contains the expected tuples.

        Args:
            stream(Stream): Stream to be tested.
            expected(list): Sequence of expected tuples.
            ordered(bool): True if the ordering of received tuples must match expected.

        Returns:
            Stream: stream