|
1 | 1 | import numpy
|
2 | 2 | import pytest
|
3 | 3 |
|
4 |
| -from pymilvus import CollectionSchema, FieldSchema, DataType |
| 4 | +from pymilvus import CollectionSchema, FieldSchema, DataType, MilvusException |
5 | 5 | from utils import *
|
| 6 | +from pymilvus.orm import schema as s |
6 | 7 |
|
7 | 8 |
|
8 | 9 | class TestCollectionSchema:
|
@@ -143,3 +144,23 @@ def test_to_dict(self, raw_dict_norm, raw_dict_float_vector, raw_dict_binary_vec
|
143 | 144 | # for f in fields:
|
144 | 145 | # if f.dtype == DataType.FLOAT_VECTOR:
|
145 | 146 | # assert f.dim == len(dataframe1['float_vec'].values[0])
|
| 147 | + |
| 148 | +class TestCheckInsertDataSchema: |
| 149 | + def test_check_insert_data_schema_issue1324(self): |
| 150 | + schema = CollectionSchema([ |
| 151 | + FieldSchema(name="id", dtype=DataType.INT64, descrition="int64", is_primary=True, auto_id=True), |
| 152 | + FieldSchema(name="embedding", dtype=DataType.FLOAT_VECTOR, descrition="float vector", dim=2), |
| 153 | + FieldSchema(name="work_id2", dtype=5, descrition="work id"), |
| 154 | + FieldSchema(name='path', dtype=DataType.VARCHAR, description='path to image', max_length=200), |
| 155 | + FieldSchema(name="uid", dtype=DataType.INT64, descrition="user id"), |
| 156 | + ]) |
| 157 | + |
| 158 | + data = [ |
| 159 | + [[0.003984056, 0.05035976]], |
| 160 | + ['15755403'], |
| 161 | + ['https://xxx.com/app/works/105149/2023-01-11/w_63be653c4643b/963be653c8aa8c.jpg'], |
| 162 | + ['105149'], |
| 163 | + ] |
| 164 | + |
| 165 | + with pytest.raises(MilvusException): |
| 166 | + s.check_insert_data_schema(schema, data) |
0 commit comments