6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-02-02 10:50:42 +01:00
firebird-qa/tests/bugs/core_4199_test.py

57 lines
1.7 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_4199
# title: Add optional START WITH clause to identity columns
# decription:
# We create table with identity column and use 'START WITH' clause for it.
# Then we add three rows in this table and calculate difference betwee max and min
# values of this identity column. In must be equal 2.
#
# ::: NB :::
# Behaviour of FB 4.x was changed since 06-aug-2020 when core-6084 was fixed:
# now FB 4.x will assign to ID column values which less than FB 3.x for 1.
# For this reason it was changed avoid check for concrete values.
# Rather, it is enough to verify only difference between max and min ID.
#
# Checked on 4.0.0.2164, 3.0.7.33356.
#
# tracker_id: CORE-4199
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
recreate table test(id int generated by default as identity (start with 1000) );
commit;
insert into test default values;
insert into test default values;
insert into test default values;
set heading off;
select max(id)-min(id) from test;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
2
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.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