6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

Added/Updated bugs\core_4452_test.py: removed dependency on 'show collation' output. Added substitutions to suppress output of all COLL-VERSION details.

This commit is contained in:
zotov 2022-04-24 12:51:25 +03:00
parent 5be7d5275b
commit bd090f1ecf

View File

@ -12,45 +12,107 @@ FBTEST: bugs.core_4452
import pytest
from firebird.qa import *
substitutions = [('COLL-VERSION=\\d{2,}.\\d{2,}', 'COLL-VERSION=111.222'),
('COLL-VERSION=\\d+\\.\\d+\\.\\d+\\.\\d+', 'COLL-VERSION=111.222')]
substitutions = [
('SPECIFIC_ATTR_BLOB_ID.*', 'SPECIFIC_ATTR_BLOB_ID')
,('COLL-VERSION=\\d+.\\d+(;ICU-VERSION=\\d+.\\d+)?.*', 'COLL-VERSION=<attr>')
]
db = db_factory()
test_script = """
show collation;
set autoddl off;
commit;
create collation name_coll for utf8 from unicode CASE INSENSITIVE;
create collation nums_coll for utf8 from unicode CASE INSENSITIVE 'NUMERIC-SORT=1';
commit;
show collation;
drop collation name_coll;
drop collation nums_coll;
commit;
create collation name_coll for utf8 from unicode CASE INSENSITIVE;
create collation nums_coll for utf8 from unicode CASE INSENSITIVE 'NUMERIC-SORT=1';
commit;
show collation;
drop collation name_coll;
drop collation nums_coll;
commit;
show collation;
set count on;
set list on;
set blob all;
create or alter view v_info as
select
rc.rdb$collation_name
,rc.rdb$collation_attributes
,rc.rdb$base_collation_name
,rc.rdb$specific_attributes as specific_attr_blob_id
,rs.rdb$character_set_name
,rs.rdb$number_of_characters
,rs.rdb$bytes_per_character
from rdb$collations rc
join rdb$character_sets rs on rc.rdb$character_set_id = rs.rdb$character_set_id
where
rc.rdb$system_flag is distinct from 1
;
commit;
set autoddl off;
commit;
create collation name_coll for utf8 from unicode CASE INSENSITIVE;
create collation nums_coll for utf8 from unicode CASE INSENSITIVE 'NUMERIC-SORT=1';
commit;
select 'point-1' as msg, v.* from v_info v;
drop collation name_coll;
drop collation nums_coll;
commit;
create collation name_coll for utf8 from unicode CASE INSENSITIVE;
create collation nums_coll for utf8 from unicode CASE INSENSITIVE 'NUMERIC-SORT=1';
commit;
select 'point-2' as msg, v.* from v_info v;
drop collation name_coll;
drop collation nums_coll;
commit;
select 'point-3' as msg, v.* from v_info v;
"""
act = isql_act('db', test_script, substitutions=substitutions)
expected_stdout = """
NAME_COLL, CHARACTER SET UTF8, FROM EXTERNAL ('UNICODE'), PAD SPACE, CASE INSENSITIVE, 'COLL-VERSION=153.88'
NUMS_COLL, CHARACTER SET UTF8, FROM EXTERNAL ('UNICODE'), PAD SPACE, CASE INSENSITIVE, 'COLL-VERSION=153.88;NUMERIC-SORT=1'
MSG point-1
RDB$COLLATION_NAME NAME_COLL
RDB$COLLATION_ATTRIBUTES 3
RDB$BASE_COLLATION_NAME UNICODE
SPECIFIC_ATTR_BLOB_ID 1d:1eb
COLL-VERSION=153.88;ICU-VERSION=63.1
RDB$CHARACTER_SET_NAME UTF8
RDB$NUMBER_OF_CHARACTERS <null>
RDB$BYTES_PER_CHARACTER 4
NAME_COLL, CHARACTER SET UTF8, FROM EXTERNAL ('UNICODE'), PAD SPACE, CASE INSENSITIVE, 'COLL-VERSION=153.88'
NUMS_COLL, CHARACTER SET UTF8, FROM EXTERNAL ('UNICODE'), PAD SPACE, CASE INSENSITIVE, 'COLL-VERSION=153.88;NUMERIC-SORT=1'
MSG point-1
RDB$COLLATION_NAME NUMS_COLL
RDB$COLLATION_ATTRIBUTES 3
RDB$BASE_COLLATION_NAME UNICODE
SPECIFIC_ATTR_BLOB_ID 1d:1ec
COLL-VERSION=153.88;ICU-VERSION=63.1;NUMERIC-SORT=1
RDB$CHARACTER_SET_NAME UTF8
RDB$NUMBER_OF_CHARACTERS <null>
RDB$BYTES_PER_CHARACTER 4
Records affected: 2
MSG point-2
RDB$COLLATION_NAME NAME_COLL
RDB$COLLATION_ATTRIBUTES 3
RDB$BASE_COLLATION_NAME UNICODE
SPECIFIC_ATTR_BLOB_ID 1d:1ed
COLL-VERSION=153.88;ICU-VERSION=63.1
RDB$CHARACTER_SET_NAME UTF8
RDB$NUMBER_OF_CHARACTERS <null>
RDB$BYTES_PER_CHARACTER 4
MSG point-2
RDB$COLLATION_NAME NUMS_COLL
RDB$COLLATION_ATTRIBUTES 3
RDB$BASE_COLLATION_NAME UNICODE
SPECIFIC_ATTR_BLOB_ID 1d:1ee
COLL-VERSION=153.88;ICU-VERSION=63.1;NUMERIC-SORT=1
RDB$CHARACTER_SET_NAME UTF8
RDB$NUMBER_OF_CHARACTERS <null>
RDB$BYTES_PER_CHARACTER 4
Records affected: 2
Records affected: 0
"""
expected_stderr = """
There are no user-defined collations in this database
There are no user-defined collations in this database
"""
@pytest.mark.version('>=3.0')