From 487a1f26aed2581ba7c82c43d9ab5916a1a456e9 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 25 Aug 2022 10:56:29 +0800 Subject: [PATCH] add test cases --- tests/system-test/2-query/interp.py | 59 +++++++++++++++++++---------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py index 0fe86e44eb..5550519e05 100644 --- a/tests/system-test/2-query/interp.py +++ b/tests/system-test/2-query/interp.py @@ -552,37 +552,54 @@ class TDTestCase: tdSql.checkData(1, 0, 15) tdLog.printNoPrefix("==========step9:test multi-interp cases") - tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-12 00:00:05') every(1d) fill(null)") - tdSql.checkRows(3) + tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(null)") + tdSql.checkRows(5) tdSql.checkCols(4) - tdSql.checkData(0, 0, None) - tdSql.checkData(1, 0, 15) - tdSql.checkData(2, 0, None) - tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-12 00:00:05') every(1d) fill(value, 1)") - tdSql.checkRows(3) + for i in range (tdSql.queryCols): + tdSql.checkData(0, i, None) + tdSql.checkData(1, i, None) + tdSql.checkData(2, i, 15) + tdSql.checkData(3, i, None) + tdSql.checkData(4, i, None) + + tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(value, 1)") + tdSql.checkRows(5) tdSql.checkCols(4) - tdSql.checkData(0, 0, 1) - tdSql.checkData(1, 0, 15) - tdSql.checkData(2, 0, 1) - tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-12 00:00:05') every(1d) fill(prev)") - tdSql.checkRows(3) + for i in range (tdSql.queryCols): + tdSql.checkData(0, i, 1) + tdSql.checkData(1, i, 1) + tdSql.checkData(2, i, 15) + tdSql.checkData(3, i, 1) + tdSql.checkData(4, i, 1) + + tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(prev)") + tdSql.checkRows(5) tdSql.checkCols(4) - tdSql.checkData(0, 0, 5) - tdSql.checkData(1, 0, 15) - tdSql.checkData(2, 0, 15) - tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-12 00:00:05') every(1d) fill(next)") - tdSql.checkRows(2) + for i in range (tdSql.queryCols): + tdSql.checkData(0, i, 5) + tdSql.checkData(1, i, 5) + tdSql.checkData(2, i, 15) + tdSql.checkData(3, i, 15) + tdSql.checkData(4, i, 15) + + tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(next)") + tdSql.checkRows(3) tdSql.checkCols(4) - tdSql.checkData(0, 0, 15) - tdSql.checkData(1, 0, 15) - tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-12 00:00:05') every(1d) fill(linear)") + for i in range (tdSql.queryCols): + tdSql.checkData(0, i, 15) + tdSql.checkData(1, i, 15) + tdSql.checkData(2, i, 15) + + tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(linear)") tdSql.checkRows(1) tdSql.checkCols(4) - tdSql.checkData(0, 0, 15) + + for i in range (tdSql.queryCols): + tdSql.checkData(0, i, 15) tdLog.printNoPrefix("==========step10:test error cases") -- GitLab