def table_schema_factory(): param = { 'table_name': fake.table_name(), 'dimension': random.randint(0, 999), 'index_type': IndexType.IDMAP, 'store_raw_vector': False } return Prepare.table_schema(**param)
def test_table_schema(self): param = { 'table_name': fake.table_name(), 'dimension': random.randint(0, 999), 'index_type': IndexType.FLAT, 'store_raw_vector': False } res = Prepare.table_schema(**param) assert isinstance(res, ttypes.TableSchema)
def test_range(self): param = { 'start': '200', 'end': '1000' } res = Prepare.range(**param) assert isinstance(res, ttypes.Range) assert res.start_value == '200' assert res.end_value == '1000'
def test_records(self): vecs = [[random.random() for _ in range(256)] for _ in range(20)] res = Prepare.records(vecs) assert isinstance(res, list) assert isinstance(res[0], ttypes.RowRecord) assert isinstance(res[0].vector_data, bytes)
def test_row_record(self): vec = [random.random() + random.randint(0, 9) for _ in range(256)] res = Prepare.row_record(vec) assert isinstance(res, ttypes.RowRecord) assert isinstance(res.vector_data, bytes)
def test_ranges(self): param = ranges_factory() res = Prepare.ranges(param) assert isinstance(res, list) assert isinstance(res[0], ttypes.Range)
def test_range(self): param = range_factory() res = Prepare.range(param[0], param[1]) assert isinstance(res, ttypes.Range)
def records_factory(dimension): return Prepare.records([[random.random() for _ in range(dimension)] for _ in range(20)])
def range_factory(): param = { 'start': str(random.randint(1, 10)), 'end': str(random.randint(11, 20)), } return Prepare.range(**param)
def query_ranges_factory(): param = [('2019-06-25', '2019-06-25')] return Prepare.ranges(param)
def test_ranges(self): param = [('2019-02-02','2019-02-02')] res = Prepare.ranges(param) assert isinstance(res, list) assert isinstance(res[0], ttypes.Range)
def test_range(self): param = {'start_date':'2019-02-02','end_date':'2019-02-02'} res = Prepare.range(**param) assert isinstance(res, ttypes.Range)
def range_factory(): param = { 'start_date': '2019-06-25', 'end_date': '2019-06-25' } return Prepare.range(**param)