Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b762a699
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b762a699
编写于
9月 27, 2021
作者:
A
AlexDuan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'tdigest' of
https://github.com/taosdata/TDengine
into tdigest
上级
6f9b51cd
d04e33b5
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
420 addition
and
17 deletion
+420
-17
tests/pytest/functions/queryTestCases.py
tests/pytest/functions/queryTestCases.py
+381
-15
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+39
-2
未找到文件。
tests/pytest/functions/queryTestCases.py
浏览文件 @
b762a699
此差异已折叠。
点击以展开。
tests/pytest/util/sql.py
浏览文件 @
b762a699
###################################################################
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
...
...
@@ -184,7 +184,11 @@ class TDSql:
if
self
.
queryResult
[
row
][
col
]
!=
data
:
if
self
.
cursor
.
istype
(
col
,
"TIMESTAMP"
):
# suppose user want to check nanosecond timestamp if a longer data passed
if
(
len
(
data
)
>=
28
):
if
isinstance
(
data
,
int
)
or
isinstance
(
data
,
float
):
if
pd
.
to_datetime
(
self
.
queryResult
[
row
][
col
])
==
pd
.
to_datetime
(
data
):
tdLog
.
info
(
"sql:%s, row:%d col:%d data:%d == expect:%s"
%
(
self
.
sql
,
row
,
col
,
self
.
queryResult
[
row
][
col
],
data
))
elif
(
len
(
data
)
>=
28
):
if
pd
.
to_datetime
(
self
.
queryResult
[
row
][
col
])
==
pd
.
to_datetime
(
data
):
tdLog
.
info
(
"sql:%s, row:%d col:%d data:%d == expect:%s"
%
(
self
.
sql
,
row
,
col
,
self
.
queryResult
[
row
][
col
],
data
))
...
...
@@ -223,6 +227,39 @@ class TDSql:
tdLog
.
info
(
"sql:%s, row:%d col:%d data:%s == expect:%d"
%
(
self
.
sql
,
row
,
col
,
self
.
queryResult
[
row
][
col
],
data
))
def
checkDeviaRation
(
self
,
row
,
col
,
data
,
deviation
=
0.001
):
self
.
checkRowCol
(
row
,
col
)
if
data
is
None
:
self
.
checkData
(
row
,
col
,
None
)
return
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
if
data
is
not
None
and
len
(
self
.
queryResult
)
==
0
:
tdLog
.
exit
(
f
"
{
caller
.
filename
}
(
{
caller
.
lineno
}
) failed: sql:
{
self
.
sql
}
, data:
{
data
}
, "
f
"expect result is not None but it is"
)
args
=
(
caller
.
filename
,
caller
.
lineno
,
self
.
sql
,
data
,
type
(
data
),
deviation
,
type
(
deviation
),
self
.
queryResult
[
row
][
col
],
type
(
self
.
queryResult
[
row
][
col
])
)
if
not
(
isinstance
(
data
,
int
)
or
isinstance
(
data
,
float
)):
tdLog
.
exit
(
f
"
{
args
[
0
]
}
(
{
args
[
1
]
}
) failed: sql:
{
args
[
2
]
}
, data:
{
args
[
3
]
}
, "
f
"expect type: int or float, actual type:
{
args
[
4
]
}
"
)
if
not
(
isinstance
(
deviation
,
int
)
or
isinstance
(
deviation
,
float
))
or
type
(
data
)
==
type
(
True
):
tdLog
.
exit
(
f
"
{
args
[
0
]
}
(
{
args
[
1
]
}
) failed: sql:
{
args
[
2
]
}
, deviation:
{
args
[
5
]
}
, "
f
"expect type: int or float, actual type:
{
args
[
6
]
}
"
)
if
not
(
isinstance
(
self
.
queryResult
[
row
][
col
],
int
)
or
isinstance
(
self
.
queryResult
[
row
][
col
],
float
)):
tdLog
.
exit
(
f
"
{
args
[
0
]
}
(
{
args
[
1
]
}
) failed: sql:
{
args
[
2
]
}
, result:
{
args
[
7
]
}
, "
f
"expect type: int or float, actual type:
{
args
[
8
]
}
"
)
devia
=
abs
((
data
-
self
.
queryResult
[
row
][
col
])
/
data
)
if
devia
<=
deviation
:
tdLog
.
info
(
f
"sql:
{
args
[
2
]
}
, result data:
{
args
[
7
]
}
, expect data:
{
args
[
3
]
}
, "
f
"actual deviation:
{
devia
}
<= expect deviation:
{
args
[
5
]
}
"
)
else
:
tdLog
.
exit
(
f
"
{
args
[
0
]
}
(
{
args
[
1
]
}
) failed: sql:
{
args
[
2
]
}
, result data:
{
args
[
7
]
}
, expect data:
{
args
[
3
]
}
,"
f
"actual deviation:
{
devia
}
<= expect deviation:
{
args
[
5
]
}
"
)
pass
def
getData
(
self
,
row
,
col
):
self
.
checkRowCol
(
row
,
col
)
return
self
.
queryResult
[
row
][
col
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录