From bd090f1ecfb50e0763283fabadf1e47859daa4e6 Mon Sep 17 00:00:00 2001 From: zotov Date: Sun, 24 Apr 2022 12:51:25 +0300 Subject: [PATCH] Added/Updated bugs\core_4452_test.py: removed dependency on 'show collation' output. Added substitutions to suppress output of all COLL-VERSION details. --- tests/bugs/core_4452_test.py | 114 +++++++++++++++++++++++++++-------- 1 file changed, 88 insertions(+), 26 deletions(-) diff --git a/tests/bugs/core_4452_test.py b/tests/bugs/core_4452_test.py index 38f99073..ac914554 100644 --- a/tests/bugs/core_4452_test.py +++ b/tests/bugs/core_4452_test.py @@ -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=') + ] 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 + 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 + 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 + 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 + 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')