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

Added/Updated tests\bugs\core_0857_test.py: Re-implemented. See notes. Checked on 6.0.0.511 (Windows/Linux); 5.0.2.1550; 4.0.6.3165; 3.0.2.32670, 3,0,1,32609

This commit is contained in:
pavel-zotov 2024-10-31 01:04:04 +03:00
parent ba89f2888e
commit 86b78aa07e

View File

@ -1,76 +1,77 @@
#coding:utf-8 #coding:utf-8
""" """
ID: issue-1247 ID: issue-1247
ISSUE: 1247 ISSUE: 1247
TITLE: Containing not working correctly TITLE: Containing not working correctly
DESCRIPTION: DESCRIPTION:
JIRA: CORE-857 JIRA: CORE-857
FBTEST: bugs.core_0857 FBTEST: bugs.core_0857
NOTES: NOTES:
[06.10.2022] pzotov [31.10.2024] pzotov
Could not complete adjusting for LINUX in new-qa. Bug was fixed for too old FB (2.0 RC4 / 2.1 ALpha 1), firebird-driver and/or QA-plugin
DEFERRED. will not able to run on this version in order to reproduce problem.
""" Checked on 6.0.0.511 (Windows/Linux); 5.0.2.1550; 4.0.6.3165; 3.0.2.32670, 3,0,1,32609
"""
import platform from pathlib import Path
import pytest
from firebird.qa import * import pytest
from firebird.qa import *
init_script = """
set echo on; db = db_factory(charset='WIN1252')
set bail on; act = isql_act('db', substitutions=[('[ \\t]+', ' ')])
create collation test_coll_ci_ai for win1252 from WIN_PTBR tmp_sql = temp_file('tmp_core_0857.sql')
case insensitive
accent insensitive @pytest.mark.version('>=3.0.0')
; def test_1(act: Action, tmp_sql: Path):
create table test ( test_script = """
id int, set bail on;
f01 varchar(100), create collation test_coll_ci_ai for win1252 from WIN_PTBR
f02 varchar(100) collate WIN_PTBR case insensitive
); accent insensitive
;
insert into test(id, f01) values(1, 'IHF|groß|850xC|P1');
update test set f02=f01; create table test (
commit; id int,
create view v_test as f01 varchar(100),
select octet_length(t.f01) - octet_length(replace(t.f01, 'ß', '')) as "octet_length diff:" from test t; f02 varchar(100) collate WIN_PTBR
""" );
db = db_factory(charset='WIN1252', init=init_script) insert into test(id, f01) values(1, 'IHF|groß|850xC|P1');
update test set f02=f01;
expected_stdout = """ commit;
CONNECTION_CSET WIN1252 create view v_test as
test_1 result: <null> select octet_length(t.f01) - octet_length(replace(t.f01, 'ß', '')) as "octet_length diff:" from test t;
test_2 result: 1 commit;
ci_ai result: 1
between result: 1 set list on;
octet_length diff: 1 select c.rdb$character_set_name as connection_cset
""" from mon$attachments a
join rdb$character_sets c on a.mon$character_set_id = c.rdb$character_set_id
test_script = """ where a.mon$attachment_id = current_connection;
set list on;
select c.rdb$character_set_name as connection_cset select t.id as "test_1 result:" from rdb$database r left join test t on t.f01 not containing 'P1' and t.f01 like 'IHF|gro_|850_C|P1';
from mon$attachments a select t.id as "test_2 result:" from rdb$database r left join test t on t.f01 containing 'P1' and t.f01 like 'IHF|gro_|850_C|P1';
join rdb$character_sets c on a.mon$character_set_id = c.rdb$character_set_id select t.id as "ci_ai result:" from rdb$database r left join test t on lower(t.f02) = upper(t.f02);
where a.mon$attachment_id = current_connection; select t.id as "between result:" from rdb$database r left join test t on lower(t.f01) between lower(t.f02) and upper(t.f02);
select * from v_test;
select t.id as "test_1 result:" from rdb$database r left join test t on t.f01 not containing 'P1' and t.f01 like 'IHF|gro_|850_C|P1'; """
select t.id as "test_2 result:" from rdb$database r left join test t on t.f01 containing 'P1' and t.f01 like 'IHF|gro_|850_C|P1';
select t.id as "ci_ai result:" from rdb$database r left join test t on lower(t.f02) = upper(t.f02); # ::: NB :::
select t.id as "between result:" from rdb$database r left join test t on lower(t.f01) between lower(t.f02) and upper(t.f02); # For proper output of test, input script must be encoded in cp1252 rather than in UTF-8.
select * from v_test; #
""" tmp_sql.write_text(test_script, encoding = 'cp1252')
act = isql_act('db', test_script) act.expected_stdout = """
CONNECTION_CSET WIN1252
@pytest.mark.skipif(platform.system() != 'Windows', reason='FIXME: see notes') test_1 result: <null>
@pytest.mark.version('>=3') test_2 result: 1
def test_1(act: Action): ci_ai result: 1
act.expected_stdout = expected_stdout between result: 1
act.execute() octet_length diff: 1
assert act.clean_stdout == act.clean_expected_stdout """
act.isql(switches = ['-q'], input_file = tmp_sql, charset = 'win1252', combine_output = True)
assert act.clean_stdout == act.clean_expected_stdout