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

40 lines
1.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-02-04 19:05:19 +01:00
"""
ID: dml.join-01
FBTEST: functional.dml.join.01
TITLE: NAMED COLUMNS join
DESCRIPTION:
<named columns join> ::=
<table reference> <join type> JOIN <table reference>
USING ( <column list> )
"""
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
init_script = """
CREATE TABLE employee( id_employee INTEGER , prenom VARCHAR(20) ,id_department INTEGER, PRIMARY KEY(id_employee));
2021-04-26 20:07:00 +02:00
CREATE TABLE department(id_department INTEGER, name VARCHAR(20));
INSERT INTO department(id_department, name) values(1,'somme');
INSERT INTO department(id_department, name) values(2,'pas de calais');
INSERT INTO employee(id_employee, prenom,id_department) VALUES (1,'benoit',1 );
INSERT INTO employee(id_employee, prenom,id_department) VALUES (2,'tom',2 );"""
2022-02-04 19:05:19 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
act = isql_act('db', "select employee.prenom, department.name from employee join department using (id_department);")
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
PRENOM NAME
==================== ====================
benoit somme
tom pas de calais
"""
2022-02-04 19:05:19 +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