Beispiel #1
0
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)
Beispiel #2
0
 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)
Beispiel #3
0
    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'
Beispiel #4
0
 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)
Beispiel #5
0
 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)
Beispiel #6
0
 def test_ranges(self):
     param = ranges_factory()
     res = Prepare.ranges(param)
     assert isinstance(res, list)
     assert isinstance(res[0], ttypes.Range)
Beispiel #7
0
 def test_range(self):
     param = range_factory()
     res = Prepare.range(param[0], param[1])
     assert isinstance(res, ttypes.Range)
Beispiel #8
0
def records_factory(dimension):
    return Prepare.records([[random.random() for _ in range(dimension)] for _ in range(20)])
Beispiel #9
0
def range_factory():
    param = {
        'start': str(random.randint(1, 10)),
        'end': str(random.randint(11, 20)),
    }
    return Prepare.range(**param)
Beispiel #10
0
def query_ranges_factory():
    param = [('2019-06-25', '2019-06-25')]
    return Prepare.ranges(param)
Beispiel #11
0
 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)
Beispiel #12
0
 def test_range(self):
     param = {'start_date':'2019-02-02','end_date':'2019-02-02'}
     res = Prepare.range(**param)
     assert isinstance(res, ttypes.Range)
Beispiel #13
0
def range_factory():
    param = {
        'start_date': '2019-06-25',
        'end_date': '2019-06-25'
    }
    return Prepare.range(**param)