From 305dc3318c9934f1ba9df457b9d8ad43ab972ae0 Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Sun, 4 Jun 2023 10:22:26 +0300 Subject: [PATCH] Added/Updated tests\bugs\gh_7604_test.py: moved DDL with non-ascii text into 'init_sql' to be executed on initial phase, otherwise get exception UnicodeEncodeError: 'charmap' codec can not encode characters in position 208-211: character maps to [undefined]. --- tests/bugs/gh_7604_test.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/bugs/gh_7604_test.py b/tests/bugs/gh_7604_test.py index c9340aad..37ff64ca 100644 --- a/tests/bugs/gh_7604_test.py +++ b/tests/bugs/gh_7604_test.py @@ -13,7 +13,19 @@ import locale import pytest from firebird.qa import * -db = db_factory(charset = 'utf8') +init_sql = """ + set term ^; + create or alter function sp_test_func returns blob sub_type text character set utf8 as + declare runtotal blob sub_type text; + begin + runtotal = 'мама мыла раму'; + return runtotal; + end + ^ + set term ;^ + commit; +""" +db = db_factory(charset = 'utf8', init = init_sql) act = python_act('db', substitutions=[('^((?!sqltype:).)*$',''),('[ \t]+',' '),('.*alias:.*','')]) @@ -21,16 +33,6 @@ act = python_act('db', substitutions=[('^((?!sqltype:).)*$',''),('[ \t]+',' '),( def test_1(act: Action): test_sql = """ - set term ^; - create or alter function sp_test_func returns blob sub_type text character set utf8 as - declare runtotal blob sub_type text; - begin - runtotal = 'мама мыла раму'; - return runtotal; - end - ^ - set term ;^ - commit; set list on; set sqlda_display on; select sp_test_func() as runtotal from rdb$database rows 0;