6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-02-02 02:40:42 +01:00

Added/Updated tests\bugs\core_5093_test.py: expected_output depends on major FB version, see definition of 'blob_new_cset' variable/

This commit is contained in:
pavel-zotov 2024-01-24 15:57:13 +03:00
parent 6248932d5c
commit 674b360dfb

View File

@ -15,6 +15,11 @@ FBTEST: bugs.core_5093
NOTES:
[23.01.2024] pzotov
Adjusted output after fixed gh-7924: column 'b_added_charset' character set must be changed to utf8.
[24.01.2024] pzotov
Currently gh-7924 fixed only for FB 6.x, thus charsets for FB 3.x ... 5.x will not be changed.
Because of that, expected_output depends on major FB version, see its definition in 'blob_new_cset'.
Checked on 6.0.0.223, 5.0.1.1322
"""
import pytest
@ -56,7 +61,7 @@ db = db_factory(charset='UTF8', init=init_script)
act = python_act('db', substitutions=substitutions)
sql_script = """
alter table t1
alter table t1
alter si type int computed by (32767) -- LONG
,alter bi type int computed by (2147483647) -- LONG
,alter s2 type smallint computed by ( 1 + mod(bi, nullif(si,0)) ) -- SHORT
@ -79,11 +84,10 @@ alter table t1
,alter b_change_charset type blob character set iso8859_1 computed by ('å') -- BLOB
,alter b_remove_charset type blob /*character set win1252 */ computed by ('Æ') -- BLOB
,alter b_added_charset type blob character set utf8 computed by ('') -- BLOB
;
commit;
set sqlda_display on;
select * from t1;
exit;
;
commit;
set sqlda_display on;
select * from t1;
"""
expected_stdout_a = """
@ -121,7 +125,24 @@ expected_stdout_a = """
: NAME: B_ADDED_CHARSET ALIAS: B_ADDED_CHARSET
"""
expected_stdout_b = """
BLOB_NEW_CSET_5X = 'CHARSET: 0 NONE'
BLOB_NEW_CSET_6X = 'CHARSET: 4 UTF8'
@pytest.mark.version('>=3.0')
def test_1(act: Action):
act.expected_stdout = expected_stdout_a
act.isql(switches=['-q', '-m'], input='set sqlda_display on; select * from t1;')
act.stdout = act.stdout.upper()
assert act.clean_stdout == act.clean_expected_stdout
act.reset()
####################################################
# ::: NB :::
# We have to separate result for B_ADDED_CHARSET because it differs in FB 6.x and older versions
#
blob_new_cset = BLOB_NEW_CSET_5X if act.is_version('<6') else BLOB_NEW_CSET_6X
####################################################
expected_stdout_b = f"""
01: SQLTYPE: 496 LONG NULLABLE SCALE: 0 SUBTYPE: 0 LEN: 4
: NAME: N0 ALIAS: N0
02: SQLTYPE: 496 LONG NULLABLE SCALE: 0 SUBTYPE: 0 LEN: 4
@ -152,18 +173,10 @@ expected_stdout_b = """
: NAME: B_CHANGE_CHARSET ALIAS: B_CHANGE_CHARSET
15: SQLTYPE: 520 BLOB NULLABLE SCALE: 0 SUBTYPE: 0 LEN: 8
: NAME: B_REMOVE_CHARSET ALIAS: B_REMOVE_CHARSET
16: SQLTYPE: 520 BLOB NULLABLE SCALE: 0 SUBTYPE: 1 LEN: 8 CHARSET: 4 UTF8
16: SQLTYPE: 520 BLOB NULLABLE SCALE: 0 SUBTYPE: 1 LEN: 8 {blob_new_cset}
: NAME: B_ADDED_CHARSET ALIAS: B_ADDED_CHARSET
"""
"""
@pytest.mark.version('>=3.0')
def test_1(act: Action):
act.expected_stdout = expected_stdout_a
act.isql(switches=['-q', '-m'], input='set sqlda_display on; select * from t1;')
act.stdout = act.stdout.upper()
assert act.clean_stdout == act.clean_expected_stdout
#
act.reset()
act.expected_stdout = expected_stdout_b
act.isql(switches=['-q', '-m'], input=sql_script)
act.stdout = act.stdout.upper()