From 826cc194acb901f04ee484bbb0e3429652b6d99e Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Tue, 9 Nov 2021 14:42:07 +0800 Subject: [PATCH] mavg/csum/sample test case developer self test modification --- tests/pytest/functions/function_all_sample.py | 33 +++++++++++-------- tests/pytest/functions/function_csum.py | 28 +++++++++++----- tests/pytest/functions/function_mavg.py | 33 ++++++++++++++----- 3 files changed, 64 insertions(+), 30 deletions(-) diff --git a/tests/pytest/functions/function_all_sample.py b/tests/pytest/functions/function_all_sample.py index 0dde52f9f6..de136976ea 100644 --- a/tests/pytest/functions/function_all_sample.py +++ b/tests/pytest/functions/function_all_sample.py @@ -388,6 +388,16 @@ class TDTestCase: self.checksample(**case25) case26 = {"k": 1000} self.checksample(**case26) + case27 = { + "table_expr": "stb1", + "condition": "group by tbname slimit 1 " + } + self.checksample(**case27) # with slimit + case28 = { + "table_expr": "stb1", + "condition": "group by tbname slimit 1 soffset 1" + } + self.checksample(**case28) # with soffset pass @@ -497,16 +507,7 @@ class TDTestCase: "condition": "group by c6" } # self.checksample(**err46) # group by normal col - err47 = { - "table_expr": "stb1", - "condition": "group by tbname slimit 1 " - } - self.checksample(**err47) # with slimit - err48 = { - "table_expr": "stb1", - "condition": "group by tbname slimit 1 soffset 1" - } - self.checksample(**err48) # with soffset + err49 = {"k": "2021-01-01 00:00:00.000"} self.checksample(**err49) # k: timestamp err50 = {"k": False} @@ -653,10 +654,14 @@ class TDTestCase: self.sample_error_query() def run(self): - # run in develop branch - self.sample_test_run() - pass - + import traceback + try: + # run in develop branch + self.sample_test_run() + pass + except Exception as e: + traceback.print_exc() + raise e def stop(self): tdSql.close() diff --git a/tests/pytest/functions/function_csum.py b/tests/pytest/functions/function_csum.py index 0e6e844f36..b8ac352b07 100644 --- a/tests/pytest/functions/function_csum.py +++ b/tests/pytest/functions/function_csum.py @@ -59,6 +59,12 @@ class TDTestCase: tdSql.checkRows(0) return + if "order by tbname" in condition: + tdSql.error(self.csum_query_form( + col=col, alias=alias, table_expr=table_expr, condition=condition + )) + return + if "group" in condition: tb_condition = condition.split("group by")[1].split(" ")[1] @@ -195,11 +201,6 @@ class TDTestCase: # case20~21: with order by case20 = {"condition": "order by ts"} self.checkcsum(**case20) - case21 = { - "table_expr": "stb1", - "condition": "group by tbname order by tbname" - } - self.checkcsum(**case21) # case22: with union case22 = { @@ -290,6 +291,11 @@ class TDTestCase: "condition": "group by tbname slimit 1 soffset 1" } tdSql.error(self.csum_query_form(**slimit_soffset_sql)) + order_by_tbname_sql = { + "table_expr": "stb1", + "condition": "group by tbname order by tbname" + } + tdSql.error(self.csum_query_form(**order_by_tbname_sql)) pass @@ -398,9 +404,15 @@ class TDTestCase: self.csum_error_query() def run(self): - # run in develop branch - self.csum_test_run() - pass + import traceback + try: + # run in develop branch + self.csum_test_run() + pass + except Exception as e: + traceback.print_exc() + raise e + def stop(self): diff --git a/tests/pytest/functions/function_mavg.py b/tests/pytest/functions/function_mavg.py index c859061388..f18f8f566f 100644 --- a/tests/pytest/functions/function_mavg.py +++ b/tests/pytest/functions/function_mavg.py @@ -154,6 +154,13 @@ class TDTestCase: table_expr=table_expr, condition=condition )) + if "order by tbname" in condition.lower(): + print(f"case in {line}: ", end='') + return tdSql.error(self.mavg_query_form( + sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr, + table_expr=table_expr, condition=condition + )) + if all(["group" in condition.lower(), "tbname" not in condition.lower()]): print(f"case in {line}: ", end='') return tdSql.error(self.mavg_query_form( @@ -356,11 +363,11 @@ class TDTestCase: # case20~21: with order by case20 = {"condition": "order by ts"} self.checkmavg(**case20) - case21 = { - "table_expr": "stb1", - "condition": "group by tbname order by tbname" - } - self.checkmavg(**case21) + #case21 = { + # "table_expr": "stb1", + # "condition": "group by tbname order by tbname" + #} + #self.checkmavg(**case21) # case22: with union case22 = { @@ -538,6 +545,11 @@ class TDTestCase: self.checkmavg(**err66) # k: NULL err67 = {"k": 0.999999} self.checkmavg(**err67) # k: left out of [1, 1000] + err68 = { + "table_expr": "stb1", + "condition": "group by tbname order by tbname" # order by tbname not supported + } + self.checkmavg(**err68) pass @@ -646,9 +658,14 @@ class TDTestCase: self.mavg_error_query() def run(self): - # run in develop branch - self.mavg_test_run() - pass + import traceback + try: + # run in develop branch + self.mavg_test_run() + pass + except Exception as e: + traceback.print_exc() + raise e def stop(self): -- GitLab