Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
56e27233
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
8
Star
4
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindinsight
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
56e27233
编写于
6月 01, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 01, 2020
浏览文件
操作
浏览文件
下载
差异文件
!228 Fix function too long.
Merge pull request !228 from yuximiao/master
上级
06d026cf
858d824e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
4 deletion
+9
-4
mindinsight/profiler/common/validator/validate.py
mindinsight/profiler/common/validator/validate.py
+1
-1
tests/ut/backend/profiler/test_profiler_restful_api.py
tests/ut/backend/profiler/test_profiler_restful_api.py
+8
-3
未找到文件。
mindinsight/profiler/common/validator/validate.py
浏览文件 @
56e27233
...
@@ -133,7 +133,7 @@ def validate_sort_condition(search_condition, search_scope):
...
@@ -133,7 +133,7 @@ def validate_sort_condition(search_condition, search_scope):
if
"type"
in
sort_condition
:
if
"type"
in
sort_condition
:
sorted_type_param
=
[
'ascending'
,
'descending'
]
sorted_type_param
=
[
'ascending'
,
'descending'
]
sorted_type
=
sort_condition
.
get
(
"type"
)
sorted_type
=
sort_condition
.
get
(
"type"
)
if
sorted_type
not
in
sorted_type_param
:
if
sorted_type
and
sorted_type
not
in
sorted_type_param
:
err_msg
=
"The sorted type must be ascending or descending."
err_msg
=
"The sorted type must be ascending or descending."
log
.
error
(
err_msg
)
log
.
error
(
err_msg
)
raise
ProfilerSortConditionException
(
err_msg
)
raise
ProfilerSortConditionException
(
err_msg
)
...
...
tests/ut/backend/profiler/test_profiler_restful_api.py
浏览文件 @
56e27233
...
@@ -50,17 +50,14 @@ class TestProfilerRestfulApi(TestCase):
...
@@ -50,17 +50,14 @@ class TestProfilerRestfulApi(TestCase):
self
.
assertEqual
(
200
,
response
.
status_code
)
self
.
assertEqual
(
200
,
response
.
status_code
)
self
.
assertDictEqual
(
expect_result
,
response
.
get_json
())
self
.
assertDictEqual
(
expect_result
,
response
.
get_json
())
@
mock
.
patch
(
'mindinsight.backend.lineagemgr.lineage_api.settings'
)
@
mock
.
patch
(
'mindinsight.profiler.analyser.base_analyser.BaseAnalyser.query'
)
@
mock
.
patch
(
'mindinsight.profiler.analyser.base_analyser.BaseAnalyser.query'
)
def
test_ops_search_failed
(
self
,
*
args
):
def
test_ops_search_failed
(
self
,
*
args
):
"""Test the failed of ops/search."""
"""Test the failed of ops/search."""
base_dir
=
'/path/to/test_profiler_base'
expect_result
=
{
expect_result
=
{
'object'
:
[
"test"
],
'object'
:
[
"test"
],
'count'
:
1
'count'
:
1
}
}
args
[
0
].
return_value
=
expect_result
args
[
0
].
return_value
=
expect_result
args
[
1
].
SUMMARY_BASE_DIR
=
base_dir
response
=
self
.
app_client
.
post
(
self
.
url
,
data
=
json
.
dumps
(
1
))
response
=
self
.
app_client
.
post
(
self
.
url
,
data
=
json
.
dumps
(
1
))
self
.
assertEqual
(
400
,
response
.
status_code
)
self
.
assertEqual
(
400
,
response
.
status_code
)
expect_result
=
{
expect_result
=
{
...
@@ -89,6 +86,14 @@ class TestProfilerRestfulApi(TestCase):
...
@@ -89,6 +86,14 @@ class TestProfilerRestfulApi(TestCase):
del
result
[
"error_msg"
]
del
result
[
"error_msg"
]
self
.
assertDictEqual
(
expect_result
,
result
)
self
.
assertDictEqual
(
expect_result
,
result
)
@
mock
.
patch
(
'mindinsight.profiler.analyser.base_analyser.BaseAnalyser.query'
)
def
test_ops_search_search_condition_failed
(
self
,
*
args
):
"""Test search condition error."""
expect_result
=
{
'object'
:
[
"test"
],
'count'
:
1
}
args
[
0
].
return_value
=
expect_result
body_data
=
{
"op_type"
:
"aicore_type"
,
"device_id"
:
"1"
,
"group_condition"
:
1
}
body_data
=
{
"op_type"
:
"aicore_type"
,
"device_id"
:
"1"
,
"group_condition"
:
1
}
response
=
self
.
app_client
.
post
(
self
.
url
,
data
=
json
.
dumps
(
body_data
))
response
=
self
.
app_client
.
post
(
self
.
url
,
data
=
json
.
dumps
(
body_data
))
self
.
assertEqual
(
400
,
response
.
status_code
)
self
.
assertEqual
(
400
,
response
.
status_code
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录