6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00

Added/Updated tests\bugs\core_5726_test.py: Added 'SQLSTATE' in substitutions: runtime error must not be suppressed. Added 'combine_output = True' in order to see SQLSTATE if any error occurs.

This commit is contained in:
pavel-zotov 2023-12-13 13:42:27 +03:00
parent 0056561f8c
commit 1f025b3f30

View File

@ -23,56 +23,49 @@ DESCRIPTION:
2^127-1 // 170141183460469231731687303715884105728-1 2^127-1 // 170141183460469231731687303715884105728-1
Checked on: 4.0.0.1635 Checked on: 4.0.0.1635
NOTES:
[25.06.2020]
4.0.0.2076: changed types in SQLDA from numeric to int128 // after discuss with Alex about CORE-6342.
JIRA: CORE-5726 JIRA: CORE-5726
FBTEST: bugs.core_5726 FBTEST: bugs.core_5726
NOTES:
[25.06.2020] pzotov
4.0.0.2076: type in SQLDA was changed from numeric to int128
(adjusted output after discussion with Alex about CORE-6342).
[13.12.2023] pzotov
Added 'SQLSTATE' in substitutions: runtime error must not be filtered out by '?!(...)' pattern
("negative lookahead assertion", see https://docs.python.org/3/library/re.html#regular-expression-syntax).
Added 'combine_output = True' in order to see SQLSTATE if any error occurs.
""" """
import pytest import pytest
from firebird.qa import * from firebird.qa import *
init_script = """ db = db_factory()
-- insert into test(n) values(
-- 1.70141183460469231731687303715);
-- insert into test(n) values(1.7014118346046923173168730371588410572700);
test_script = """
set list on;
recreate table test ( recreate table test (
id integer generated always as identity primary key, id integer generated always as identity primary key,
n numeric(38,38) n numeric(38,38)
); );
commit; commit;
"""
db = db_factory(sql_dialect=3, init=init_script)
test_script = """
set list on;
insert into test(n) values( 1.70141183460469231731687303715884105727 ); insert into test(n) values( 1.70141183460469231731687303715884105727 );
insert into test(n) values( 1.70141183460469231731687303715884105727001 ); insert into test(n) values( 1.70141183460469231731687303715884105727001 );
set sqlda_display on; set sqlda_display on;
select n as "max_precise_number" from test; select n as "max_precise_number" from test;
""" """
act = isql_act('db', test_script, substitutions=[('^((?!(sqltype|max_precise_number)).)*$', ''), act = isql_act('db', test_script, substitutions = [ ('^((?!(SQLSTATE|sqltype|max_precise_number)).)*$', ''), ('[ \t]+', ' '), ('.*alias.*', '') ] )
('[ \t]+', ' '), ('.*alias.*', '')])
expected_stdout = """ expected_stdout = """
01: sqltype: 32752 INT128 Nullable scale: -38 subtype: 1 len: 16
max_precise_number 1.70141183460469231731687303715884105727
"""
expected_stderr = """
Statement failed, SQLSTATE = 22003 Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range -numeric value is out of range
01: sqltype: 32752 INT128 Nullable scale: -38 subtype: 1 len: 16
max_precise_number 1.70141183460469231731687303715884105727
""" """
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action): def test_1(act: Action):
act.expected_stdout = expected_stdout act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr act.execute(combine_output = True)
act.execute() assert act.clean_stdout == act.clean_expected_stdout
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)