Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
a9cbf433
M
milvus
项目概览
milvus
/
milvus
10 个月 前同步成功
通知
260
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
a9cbf433
编写于
8月 14, 2023
作者:
N
nico
提交者:
GitHub
8月 14, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add cases about offset and alias (#26067)
Signed-off-by:
N
nico
<
cheng.yuan@zilliz.com
>
上级
c0870d3c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
4 deletion
+50
-4
tests/python_client/requirements.txt
tests/python_client/requirements.txt
+1
-1
tests/python_client/testcases/test_collection.py
tests/python_client/testcases/test_collection.py
+2
-3
tests/python_client/testcases/test_search.py
tests/python_client/testcases/test_search.py
+20
-0
tests/python_client/testcases/test_utility.py
tests/python_client/testcases/test_utility.py
+27
-0
未找到文件。
tests/python_client/requirements.txt
浏览文件 @
a9cbf433
...
...
@@ -12,7 +12,7 @@ allure-pytest==2.7.0
pytest-print==0.2.1
pytest-level==0.1.1
pytest-xdist==2.5.0
pymilvus==2.4.0.dev1
09
pymilvus==2.4.0.dev1
15
pytest-rerunfailures==9.1.1
git+https://github.com/Projectplace/pytest-tags
ndg-httpsclient
...
...
tests/python_client/testcases/test_collection.py
浏览文件 @
a9cbf433
...
...
@@ -3805,7 +3805,8 @@ class TestCollectionString(TestcaseBase):
schema
=
self
.
collection_schema_wrap
.
init_collection_schema
(
fields
=
fields
)[
0
]
self
.
init_collection_wrap
(
schema
=
schema
,
check_task
=
CheckTasks
.
check_collection_property
,
check_items
=
{
"schema"
:
schema
,
"primary"
:
ct
.
default_string_field_name
})
class
TestCollectionJSON
(
TestcaseBase
):
"""
******************************************************************
...
...
@@ -3884,5 +3885,3 @@ class TestCollectionJSON(TestcaseBase):
self
.
collection_wrap
.
init_collection
(
name
=
c_name
,
schema
=
schema
,
check_task
=
CheckTasks
.
check_collection_property
,
check_items
=
{
exp_name
:
c_name
,
exp_schema
:
schema
})
tests/python_client/testcases/test_search.py
浏览文件 @
a9cbf433
...
...
@@ -5425,6 +5425,26 @@ class TestSearchPagination(TestcaseBase):
# assert sorted(search_res[0].distances, key=numpy.float32) == sorted(res_distance, key=numpy.float32)
assert
set
(
search_res
[
0
].
ids
)
==
set
(
res
[
0
].
ids
[
offset
:])
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
parametrize
(
"offset"
,
[
100
,
default_nb
//
2
])
def
test_search_offset_different_position
(
self
,
offset
):
"""
target: test search pagination with offset in different position
method: create connection, collection, insert entities and search with offset
expected: search successfully
"""
# 1. initialize
collection_w
=
self
.
init_collection_general
(
prefix
,
True
)[
0
]
# 2. search with offset in params
search_params
=
{
"metric_type"
:
"COSINE"
,
"params"
:
{
"nprobe"
:
10
},
"offset"
:
offset
}
res1
=
collection_w
.
search
(
vectors
[:
default_nq
],
default_search_field
,
search_params
,
default_limit
)[
0
]
# 3. search with offset outside params
res2
=
collection_w
.
search
(
vectors
[:
default_nq
],
default_search_field
,
default_search_params
,
default_limit
,
offset
=
offset
)[
0
]
assert
res1
[
0
].
ids
==
res2
[
0
].
ids
class
TestSearchPaginationInvalid
(
TestcaseBase
):
""" Test case of search pagination """
...
...
tests/python_client/testcases/test_utility.py
浏览文件 @
a9cbf433
...
...
@@ -1647,6 +1647,33 @@ class TestUtilityBase(TestcaseBase):
assert
collection_alias
[
0
]
in
collections
assert
old_collection_name
not
in
collections
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_create_alias_using_dropped_collection_name
(
self
):
"""
target: test create alias using a dropped collection name
method: create 2 collections and drop one collection
expected: raise no exception
"""
# 1. create 2 collections
a_name
=
cf
.
gen_unique_str
(
"aa"
)
b_name
=
cf
.
gen_unique_str
(
"bb"
)
self
.
init_collection_wrap
(
name
=
a_name
,
schema
=
default_schema
,
check_task
=
CheckTasks
.
check_collection_property
,
check_items
=
{
exp_name
:
a_name
,
exp_schema
:
default_schema
})
self
.
init_collection_wrap
(
name
=
b_name
,
schema
=
default_schema
,
check_task
=
CheckTasks
.
check_collection_property
,
check_items
=
{
exp_name
:
b_name
,
exp_schema
:
default_schema
})
# 2. drop collection a
self
.
utility_wrap
.
drop_collection
(
a_name
)
assert
self
.
utility_wrap
.
has_collection
(
a_name
)[
0
]
is
False
assert
len
(
self
.
utility_wrap
.
list_aliases
(
b_name
)[
0
])
==
0
# 3. create alias with the name of collection a
self
.
utility_wrap
.
create_alias
(
b_name
,
a_name
)
b_alias
,
_
=
self
.
utility_wrap
.
list_aliases
(
b_name
)
assert
a_name
in
b_alias
class
TestUtilityAdvanced
(
TestcaseBase
):
""" Test case of index interface """
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录