From 86e6e9ec928a2705691db38afb3e558aaf7fce86 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 22 Feb 2021 13:06:40 +0800 Subject: [PATCH] modify test case for unsigned datetype --- .../pytest/functions/function_min_restart.py | 12 +++++ .../functions/function_operations_restart.py | 8 +-- .../functions/function_percentile_restart.py | 52 +++++++++++++++++++ .../functions/function_spread_restart.py | 10 +++- .../functions/function_stddev_restart.py | 12 +++++ .../pytest/functions/function_sum_restart.py | 7 +++ .../pytest/functions/function_top_restart.py | 20 +++++++ 7 files changed, 116 insertions(+), 5 deletions(-) diff --git a/tests/pytest/functions/function_min_restart.py b/tests/pytest/functions/function_min_restart.py index c8329bffa5..fc2cb761ca 100644 --- a/tests/pytest/functions/function_min_restart.py +++ b/tests/pytest/functions/function_min_restart.py @@ -58,6 +58,18 @@ class TDTestCase: tdSql.query("select min(col4) from test1") tdSql.checkData(0, 0, np.min(intData)) + + tdSql.query("select min(col11) from test1") + tdSql.checkData(0, 0, np.min(intData)) + + tdSql.query("select min(col12) from test1") + tdSql.checkData(0, 0, np.min(intData)) + + tdSql.query("select min(col13) from test1") + tdSql.checkData(0, 0, np.min(intData)) + + tdSql.query("select min(col14) from test1") + tdSql.checkData(0, 0, np.min(intData)) tdSql.query("select min(col5) from test1") tdSql.checkData(0, 0, np.min(floatData)) diff --git a/tests/pytest/functions/function_operations_restart.py b/tests/pytest/functions/function_operations_restart.py index 6e3990264c..55febe05d9 100644 --- a/tests/pytest/functions/function_operations_restart.py +++ b/tests/pytest/functions/function_operations_restart.py @@ -44,9 +44,9 @@ class TDTestCase: tdSql.checkRows(11) tdSql.checkData(0, 0, 2.0) - tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1") - tdSql.checkRows(11) - tdSql.checkData(0, 0, 3.2) + tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1") + tdSql.checkRows(10) + tdSql.checkData(0, 0, 7.2) #tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11)) tdSql.query("select col1 + col2 from test1") @@ -57,7 +57,7 @@ class TDTestCase: tdSql.checkRows(11) tdSql.checkData(10, 0, None) - tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1") + tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1") tdSql.checkRows(11) tdSql.checkData(10, 0, None) diff --git a/tests/pytest/functions/function_percentile_restart.py b/tests/pytest/functions/function_percentile_restart.py index ade10282de..5e6898784b 100644 --- a/tests/pytest/functions/function_percentile_restart.py +++ b/tests/pytest/functions/function_percentile_restart.py @@ -99,6 +99,58 @@ class TDTestCase: tdSql.query("select apercentile(col4, 100) from test") print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col11, 0) from test") + tdSql.checkData(0, 0, np.percentile(intData, 0)) + tdSql.query("select apercentile(col11, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col11, 50) from test") + tdSql.checkData(0, 0, np.percentile(intData, 50)) + tdSql.query("select apercentile(col11, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col11, 100) from test") + tdSql.checkData(0, 0, np.percentile(intData, 100)) + tdSql.query("select apercentile(col11, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + + tdSql.query("select percentile(col12, 0) from test") + tdSql.checkData(0, 0, np.percentile(intData, 0)) + tdSql.query("select apercentile(col12, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col12, 50) from test") + tdSql.checkData(0, 0, np.percentile(intData, 50)) + tdSql.query("select apercentile(col12, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col12, 100) from test") + tdSql.checkData(0, 0, np.percentile(intData, 100)) + tdSql.query("select apercentile(col12, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + + tdSql.query("select percentile(col13, 0) from test") + tdSql.checkData(0, 0, np.percentile(intData, 0)) + tdSql.query("select apercentile(col13, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col13, 50) from test") + tdSql.checkData(0, 0, np.percentile(intData, 50)) + tdSql.query("select apercentile(col13, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col13, 100) from test") + tdSql.checkData(0, 0, np.percentile(intData, 100)) + tdSql.query("select apercentile(col13, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + + tdSql.query("select percentile(col14, 0) from test") + tdSql.checkData(0, 0, np.percentile(intData, 0)) + tdSql.query("select apercentile(col14, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col14, 50) from test") + tdSql.checkData(0, 0, np.percentile(intData, 50)) + tdSql.query("select apercentile(col14, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col14, 100) from test") + tdSql.checkData(0, 0, np.percentile(intData, 100)) + tdSql.query("select apercentile(col14, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col5, 0) from test") print("query result: %s" % tdSql.getData(0, 0)) print("array result: %s" % np.percentile(floatData, 0)) diff --git a/tests/pytest/functions/function_spread_restart.py b/tests/pytest/functions/function_spread_restart.py index ba71da0a18..360b355d84 100644 --- a/tests/pytest/functions/function_spread_restart.py +++ b/tests/pytest/functions/function_spread_restart.py @@ -36,8 +36,16 @@ class TDTestCase: tdSql.error("select spread(col8) from test1") tdSql.error("select spread(col9) from test") tdSql.error("select spread(col9) from test1") - + tdSql.error("select spread(col11) from test") + tdSql.error("select spread(col11) from test1") + tdSql.error("select spread(col12) from test") + tdSql.error("select spread(col12) from test1") + tdSql.error("select spread(col13) from test") + tdSql.error("select spread(col13) from test1") + tdSql.error("select spread(col14) from test") + tdSql.error("select spread(col14) from test1") tdSql.query("select spread(col1) from test1") + tdSql.checkRows(1) tdSql.checkData(0, 0, 10) diff --git a/tests/pytest/functions/function_stddev_restart.py b/tests/pytest/functions/function_stddev_restart.py index 837f8bb406..48f9821d89 100644 --- a/tests/pytest/functions/function_stddev_restart.py +++ b/tests/pytest/functions/function_stddev_restart.py @@ -55,6 +55,18 @@ class TDTestCase: tdSql.query("select stddev(col4) from test1") tdSql.checkData(0, 0, np.std(intData)) + tdSql.query("select stddev(col11) from test1") + tdSql.checkData(0, 0, np.std(intData)) + + tdSql.query("select stddev(col12) from test1") + tdSql.checkData(0, 0, np.std(intData)) + + tdSql.query("select stddev(col13) from test1") + tdSql.checkData(0, 0, np.std(intData)) + + tdSql.query("select stddev(col14) from test1") + tdSql.checkData(0, 0, np.std(intData)) + tdSql.query("select stddev(col5) from test1") tdSql.checkData(0, 0, np.std(floatData)) diff --git a/tests/pytest/functions/function_sum_restart.py b/tests/pytest/functions/function_sum_restart.py index 7fd9ae7dd4..04ff5b7b19 100644 --- a/tests/pytest/functions/function_sum_restart.py +++ b/tests/pytest/functions/function_sum_restart.py @@ -51,6 +51,13 @@ class TDTestCase: tdSql.checkData(0, 0, np.sum(intData)) tdSql.query("select sum(col4) from test") tdSql.checkData(0, 0, np.sum(intData)) + tdSql.query("select sum(col11) from test") + tdSql.checkData(0, 0, np.sum(intData)) + tdSql.query("select sum(col12) from test") + tdSql.checkData(0, 0, np.sum(intData)) + tdSql.query("select sum(col13) from test") + tdSql.checkData(0, 0, np.sum(intData)) + tdSql.query("select sum(col14) from test") tdSql.query("select sum(col5) from test") tdSql.checkData(0, 0, np.sum(floatData)) tdSql.query("select sum(col6) from test") diff --git a/tests/pytest/functions/function_top_restart.py b/tests/pytest/functions/function_top_restart.py index 5ae96a2505..a9b0eee7af 100644 --- a/tests/pytest/functions/function_top_restart.py +++ b/tests/pytest/functions/function_top_restart.py @@ -75,6 +75,26 @@ class TDTestCase: tdSql.checkData(0, 1, 9) tdSql.checkData(1, 1, 10) + tdSql.query("select top(col11, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 9) + tdSql.checkData(1, 1, 10) + + tdSql.query("select top(col12, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 9) + tdSql.checkData(1, 1, 10) + + tdSql.query("select top(col13, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 9) + tdSql.checkData(1, 1, 10) + + tdSql.query("select top(col14, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 9) + tdSql.checkData(1, 1, 10) + tdSql.query("select top(col5, 2) from test") tdSql.checkRows(2) tdSql.checkData(0, 1, 8.1)