2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
"""
|
|
|
|
ID: issue-6113
|
|
|
|
ISSUE: 6113
|
|
|
|
TITLE: Forward-compatible expressions LOCALTIME and LOCALTIMESTAMP
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-5853
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_5853
|
2022-01-26 21:10:46 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
# version: 3.0
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
test_script_1 = """
|
|
|
|
set planonly;
|
|
|
|
select current_time, current_timestamp from rdb$database;
|
2021-12-30 19:43:52 +01:00
|
|
|
select localtime from rdb$database;
|
|
|
|
select localtimestamp from rdb$database;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
act_1 = isql_act('db', test_script_1)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
expected_stdout_1 = """
|
|
|
|
PLAN (RDB$DATABASE NATURAL)
|
2021-12-30 19:43:52 +01:00
|
|
|
PLAN (RDB$DATABASE NATURAL)
|
|
|
|
PLAN (RDB$DATABASE NATURAL)
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-12-30 19:43:52 +01:00
|
|
|
@pytest.mark.version('>=2.5.9,<4.0')
|
2021-04-28 12:42:11 +02:00
|
|
|
def test_1(act_1: Action):
|
2021-04-26 20:07:00 +02:00
|
|
|
act_1.expected_stdout = expected_stdout_1
|
|
|
|
act_1.execute()
|
2021-12-22 20:23:11 +01:00
|
|
|
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-12-30 19:43:52 +01:00
|
|
|
# version: 4.0
|
|
|
|
|
|
|
|
test_script_2 = """
|
|
|
|
set planonly;
|
|
|
|
select current_time, current_timestamp from rdb$database;
|
|
|
|
--select localtime from rdb$database;
|
|
|
|
--select localtimestamp from rdb$database;
|
|
|
|
"""
|
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
act_2 = isql_act('db', test_script_2)
|
2021-12-30 19:43:52 +01:00
|
|
|
|
|
|
|
expected_stdout_2 = """
|
|
|
|
PLAN (RDB$DATABASE NATURAL)
|
|
|
|
"""
|
|
|
|
|
|
|
|
@pytest.mark.version('>=4.0')
|
|
|
|
def test_2(act_2: Action):
|
|
|
|
act_2.expected_stdout = expected_stdout_2
|
|
|
|
act_2.execute()
|
|
|
|
assert act_2.clean_stdout == act_2.clean_expected_stdout
|