6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/bugs/core_1033_test.py

77 lines
1.8 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-19 17:54:56 +01:00
"""
ID: issue-1450
ISSUE: 1450
TITLE: LIKE doesn't work for computed values (at least in a view)
DESCRIPTION:
JIRA: CORE-1033
FBTEST: bugs.core_1033
2022-01-19 17:54:56 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
init_script = """create table TABLE_X (
2021-04-26 20:07:00 +02:00
id numeric(10,0) not null,
descr varchar(50) not null
);
commit;
create view X_VW (id, description)
as select id, x.descr || ' ('||x.id||')' from TABLE_X as x;
commit;
insert into TABLE_X values (1,'xyz');
insert into TABLE_X values (2,'xyzxyz');
insert into TABLE_X values (3,'xyz012');
commit;"""
2022-01-19 17:54:56 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
test_script = """select * from X_VW ;
2021-04-26 20:07:00 +02:00
select * from X_VW where description like 'xyz (1)' ;
select * from X_VW where description like 'xyz (%)' ;
select * from X_VW where description like 'xyz%' ;
"""
2022-01-19 17:54:56 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
expected_stdout = """
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
2 xyzxyz (2)
3 xyz012 (3)
2021-08-03 23:29:08 +02:00
2022-01-19 17:54:56 +01:00
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
2021-08-03 23:29:08 +02:00
2022-01-19 17:54:56 +01:00
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
2021-08-03 23:29:08 +02:00
2022-01-19 17:54:56 +01:00
ID DESCRIPTION
===================== ======================================================================
1 xyz (1)
2 xyzxyz (2)
3 xyz012 (3)
2021-04-26 20:07:00 +02:00
"""
2022-01-19 17:54:56 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00