From a160af0118bb6c95834838a7a91487a1564563da Mon Sep 17 00:00:00 2001 From: cpwu Date: Tue, 19 Apr 2022 15:10:56 +0800 Subject: [PATCH] fix case --- tests/system-test/2-query/cast.py | 34 +++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/tests/system-test/2-query/cast.py b/tests/system-test/2-query/cast.py index a6da455ba3..a71bb19205 100644 --- a/tests/system-test/2-query/cast.py +++ b/tests/system-test/2-query/cast.py @@ -1,3 +1,4 @@ +from this import d import taos import sys @@ -65,12 +66,37 @@ class TDTestCase: ) - tdLog.printNoPrefix("==========step3:query timestamp type") + tdLog.printNoPrefix("==========step1: cast int to int, expect no changes") + + tdSql.query("select c1 from ct4") + data_ct4 = [] + for i in range(tdSql.queryRows): + data_ct4[i] = tdSql.getData(i,0) + + tdSql.query("select c1 from t1") + data_t1 = [] + for i in range(tdSql.queryRows): + data_t1[i] = tdSql.getData(i,0) + + tdSql.query("select cast(c1 as int) as b from ct4") + for i in range(len(data_ct4)): + tdSql.checkData( i, 0, data_ct4[i]) + + tdSql.query("select cast(c1 as int) as b from t1") + for i in range(len(data_t1)): + tdSql.checkData( i, 0, data_t1[i]) + + tdLog.printNoPrefix("==========step1: cast int to bigint, expect no changes") + tdSql.query("select cast(c1 as bigint) as b from ct4") - tdSql.checkRows(12) + for i in range(len(data_ct4)): + tdSql.checkData( i, 0, data_ct4[i]) tdSql.query("select cast(c1 as bigint) as b from t1") - tdSql.checkRows(12) - tdSql.checkData(0,0, None) + for i in range(len(data_t1)): + tdSql.checkData( i, 0, data_t1[i]) + + tdSql.error("select cast(c1 as bigint) as b from ct4 interval(1y) ") + tdSql.error("select cast(c1 as bigint) as b from t1 interval(1y) ") def stop(self):