summaryrefslogtreecommitdiffstats
path: root/tests/test_executor.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_executor.py')
-rw-r--r--tests/test_executor.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_executor.py b/tests/test_executor.py
index c455f3a..6bf7d6a 100644
--- a/tests/test_executor.py
+++ b/tests/test_executor.py
@@ -1,3 +1,4 @@
+import datetime
import unittest
from datetime import date
@@ -513,6 +514,8 @@ class TestExecutor(unittest.TestCase):
self.assertEqual(result.rows, [(3,)])
def test_scalar_functions(self):
+ now = datetime.datetime.now()
+
for sql, expected in [
("CONCAT('a', 'b')", "ab"),
("CONCAT('a', NULL)", None),
@@ -569,6 +572,26 @@ class TestExecutor(unittest.TestCase):
("NULL IS NOT NULL", False),
("NULL = NULL", None),
("NULL <> NULL", None),
+ ("YEAR(CURRENT_TIMESTAMP)", now.year),
+ ("MONTH(CURRENT_TIME)", now.month),
+ ("DAY(CURRENT_DATETIME())", now.day),
+ ("YEAR(CURRENT_DATE())", now.year),
+ ("MONTH(CURRENT_DATE())", now.month),
+ ("DAY(CURRENT_DATE())", now.day),
+ ("YEAR(CURRENT_TIMESTAMP) + 1", now.year + 1),
+ (
+ "YEAR(CURRENT_TIMESTAMP) IN (YEAR(CURRENT_TIMESTAMP) + 1, YEAR(CURRENT_TIMESTAMP) * 10)",
+ False,
+ ),
+ ("YEAR(CURRENT_TIMESTAMP) = (YEAR(CURRENT_TIMESTAMP))", True),
+ ("YEAR(CURRENT_TIMESTAMP) <> (YEAR(CURRENT_TIMESTAMP))", False),
+ ("YEAR(CURRENT_DATE()) + 1", now.year + 1),
+ (
+ "YEAR(CURRENT_DATE()) IN (YEAR(CURRENT_DATE()) + 1, YEAR(CURRENT_DATE()) * 10)",
+ False,
+ ),
+ ("YEAR(CURRENT_DATE()) = (YEAR(CURRENT_DATE()))", True),
+ ("YEAR(CURRENT_DATE()) <> (YEAR(CURRENT_DATE()))", False),
]:
with self.subTest(sql):
result = execute(f"SELECT {sql}")