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

70 lines
1.7 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3779
ISSUE: 3779
TITLE: Inserting Käse into a CHARACTER SET ASCII column succeeds
DESCRIPTION:
JIRA: CORE-3416
FBTEST: bugs.core_3416
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2021-11-17 19:43:06 +01:00
from pathlib import Path
2022-01-22 21:59:15 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
init_script = """
2021-11-17 19:43:06 +01:00
create table tascii(s_ascii varchar(10) character set ascii);
create table tlatin(s_latin varchar(10) character set latin1);
commit;
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory(init=init_script)
act = python_act('db', substitutions=[('After line .*', ''), ('[\t ]+', ' ')])
expected_stdout = """
2021-04-26 20:07:00 +02:00
insert into tascii values ('Käse');
Records affected: 0
2021-11-17 19:43:06 +01:00
2021-04-26 20:07:00 +02:00
select s_ascii from tascii;
Records affected: 0
2021-11-17 19:43:06 +01:00
2021-04-26 20:07:00 +02:00
insert into tlatin values ('Käse');
Records affected: 1
2021-11-17 19:43:06 +01:00
2021-04-26 20:07:00 +02:00
select s_latin from tlatin;
S_LATIN Käse
Records affected: 1
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stderr = """
2021-11-17 19:43:06 +01:00
Statement failed, SQLSTATE = 22018
arithmetic exception, numeric overflow, or string truncation
-Cannot transliterate character between character sets
After line 4 in file /tmp/pytest-of-pcisar/pytest-559/test_10/test_script.sql
"""
2022-01-22 21:59:15 +01:00
script_file = temp_file('test_script.sql')
2021-11-17 19:43:06 +01:00
2022-01-22 21:59:15 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action, script_file: Path):
script_file.write_text("""
2021-11-17 19:43:06 +01:00
set list on;
set count on;
set echo on;
insert into tascii values ('Käse');
select s_ascii from tascii;
insert into tlatin values ('Käse');
select s_latin from tlatin;
""", encoding='cp1252')
2022-01-22 21:59:15 +01:00
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.isql(switches=[], input_file=script_file, charset='WIN1252')
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)
2021-11-17 19:43:06 +01:00
2021-04-26 20:07:00 +02:00