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

92 lines
2.9 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4487
ISSUE: 4487
TITLE: The parameterized exception does not accept not ASCII characters as parameter
DESCRIPTION:
JIRA: CORE-4160
FBTEST: bugs.core_4160
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
create or alter procedure sp_alert(a_lang char(2), a_new_amount int) as begin end;
commit;
recreate exception ex_negative_remainder ' @1 (@2)';
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
db = db_factory(charset='UTF8', init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set term ^;
create or alter procedure sp_alert(a_lang char(2), a_new_amount int) as
begin
if (a_lang = 'cz') then
exception ex_negative_remainder using ('Czech: New Balance bude menší než nula', a_new_amount);
else if (a_lang = 'pt') then
exception ex_negative_remainder using ('Portuguese: New saldo será menor do que zero', a_new_amount);
else if (a_lang = 'dm') then
exception ex_negative_remainder using ('Danish: New Balance vil være mindre end nul', a_new_amount);
else if (a_lang = 'gc') then
exception ex_negative_remainder using ('Greek: Νέα ισορροπία θα είναι κάτω από το μηδέν', a_new_amount);
else if (a_lang = 'fr') then
exception ex_negative_remainder using ('French: Nouveau solde sera inférieur à zéro', a_new_amount);
else
exception ex_negative_remainder using ('Russian: Новый остаток будет меньше нуля', a_new_amount);
end
^
set term ;^
commit;
execute procedure sp_alert('cz', -1);
execute procedure sp_alert('pt', -2);
execute procedure sp_alert('dm', -3);
execute procedure sp_alert('gc', -4);
execute procedure sp_alert('fr', -5);
execute procedure sp_alert('jp', -6);
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
act = isql_act('db', test_script, substitutions=[('-At procedure.*', '')])
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
expected_stderr = """
2021-04-26 20:07:00 +02:00
Statement failed, SQLSTATE = HY000
exception 1
-EX_NEGATIVE_REMAINDER
- Czech: New Balance bude menší než nula (-1)
Statement failed, SQLSTATE = HY000
exception 1
-EX_NEGATIVE_REMAINDER
- Portuguese: New saldo será menor do que zero (-2)
Statement failed, SQLSTATE = HY000
exception 1
-EX_NEGATIVE_REMAINDER
- Danish: New Balance vil være mindre end nul (-3)
Statement failed, SQLSTATE = HY000
exception 1
-EX_NEGATIVE_REMAINDER
- Greek: Νέα ισορροπία θα είναι κάτω από το μηδέν (-4)
Statement failed, SQLSTATE = HY000
exception 1
-EX_NEGATIVE_REMAINDER
- French: Nouveau solde sera inférieur à zéro (-5)
Statement failed, SQLSTATE = HY000
exception 1
-EX_NEGATIVE_REMAINDER
- Russian: Новый остаток будет меньше нуля (-6)
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-23 20:41:55 +01:00
def test_1(act: Action):
act.expected_stderr = expected_stderr
act.execute()
assert act.clean_stderr == act.clean_expected_stderr
2021-04-26 20:07:00 +02:00