6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/functional/tabloid/test_dbp_1940_20130412_1008.py

139 lines
4.6 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: functional.tabloid.dbp_1940_20130412_1008
# title: Common SQL. Check correctness of the results
# decription:
# tracker_id:
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(from_backup='tabloid-dbp-1940.fbk', init=init_script_1)
test_script_1 = """
set list on;
with recursive
s as (
select 0 rn from rdb$database union all select s.rn+1 from s where s.rn<29
)
,b as (
select
max(tm) mdate
from bbb
where vi
in(
select vi
from bbb
group by vi
having sum(bv) = 255
)
group by vi
order by max(tm) rows 1
)
,t as (
select dateadd(s.rn second to b.mdate) mdate
from b cross join s
)
,e as (
select t.mdate f01
,(
select count(s) from
(
select sum(x.bv) s
from bbb x
where x.tm <= t.mdate
group by x.vi
having sum(x.bv) between 85 and 170
)
) f02
from t
)
select f01,f02
from e
where f02>0
order by 1,2
;
"""
2021-04-26 20:07:00 +02:00
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
F01 2003-01-01 01:11:00.0000
F02 1
F01 2003-01-01 01:11:01.0000
F02 3
F01 2003-01-01 01:11:02.0000
F02 4
F01 2003-01-01 01:11:03.0000
F02 4
F01 2003-01-01 01:11:04.0000
F02 3
F01 2003-01-01 01:11:05.0000
F02 3
F01 2003-01-01 01:11:06.0000
F02 3
F01 2003-01-01 01:11:07.0000
F02 3
F01 2003-01-01 01:11:08.0000
F02 3
F01 2003-01-01 01:11:09.0000
F02 3
F01 2003-01-01 01:11:10.0000
F02 4
F01 2003-01-01 01:11:11.0000
F02 5
F01 2003-01-01 01:11:12.0000
F02 4
F01 2003-01-01 01:11:13.0000
F02 4
F01 2003-01-01 01:11:14.0000
F02 3
F01 2003-01-01 01:11:15.0000
F02 3
F01 2003-01-01 01:11:16.0000
F02 3
F01 2003-01-01 01:11:17.0000
F02 4
F01 2003-01-01 01:11:18.0000
F02 4
F01 2003-01-01 01:11:19.0000
F02 4
F01 2003-01-01 01:11:20.0000
F02 4
F01 2003-01-01 01:11:21.0000
F02 4
F01 2003-01-01 01:11:22.0000
F02 4
F01 2003-01-01 01:11:23.0000
F02 4
F01 2003-01-01 01:11:24.0000
F02 4
F01 2003-01-01 01:11:25.0000
F02 4
F01 2003-01-01 01:11:26.0000
F02 4
F01 2003-01-01 01:11:27.0000
F02 4
F01 2003-01-01 01:11:28.0000
F02 4
F01 2003-01-01 01:11:29.0000
F02 4
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2021-04-28 12:42:11 +02:00
def test_1(act_1: Action):
2021-04-26 20:07:00 +02:00
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
2021-04-26 20:07:00 +02:00