Пример #1
0
    def find_result(self, resp, expect):
        if resp.is_empty() and len(expect) == 0:
            return True

        if resp.is_empty():
            return False

        rows = resp.rows()
        if len(rows) < len(expect):
            return False

        new_expect = self.convert_expect(expect)

        for exp in new_expect:
            if not find_in_rows(exp.values, rows):
                return False

        return True
Пример #2
0
    def search(self, resp, expect, is_regex=False, exist=True):
        if resp.is_empty() and len(expect) == 0:
            return

        assert not resp.is_empty(), 'resp.data is None'

        rows = resp.rows()
        assert len(rows) >= len(expect), f'{len(rows)} < {len(expect)}'

        new_expect = expect
        if not is_regex:
            # convert expect to thrift value
            new_expect = self.convert_expect(expect)

        msg = 'Returned row from nebula could not be found, row: {}, resp: {}'
        for exp in new_expect:
            values, exp_str = (exp, str(exp)) if is_regex else (exp.values, row_to_string(exp))
            assert find_in_rows(values, rows) == exist, \
                msg.format(exp_str, value_to_string(rows))