def contents(self, stream, expected, ordered=True): """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 """ name = "StreamContents" + str(len(self._conditions)) if ordered: cond = sttrt._StreamContents(expected, name) else: cond = sttrt._UnorderedStreamContents(expected, name) return self.add_condition(stream, cond)
def contents(self, stream, expected, ordered=True): """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 """ name = stream.name + '_contents' if ordered: cond = sttrt._StreamContents(expected, name) cond._desc = "'{0}' stream expects tuple ordered contents: {1}.".format(stream.name, expected) else: cond = sttrt._UnorderedStreamContents(expected, name) cond._desc = "'{0}' stream expects tuple unordered contents: {1}.".format(stream.name, expected) return self.add_condition(stream, cond)
def contents(self, stream, expected, ordered=True): """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 """ name = "StreamContents" + str(len(self._conditions)) if ordered: cond = sttrt._StreamContents(expected, name) cond._desc = "'{0}' stream expects tuple ordered contents: {1}.".format(stream.name, expected) else: cond = sttrt._UnorderedStreamContents(expected, name) cond._desc = "'{0}' stream expects tuple unordered contents: {1}.".format(stream.name, expected) return self.add_condition(stream, cond)