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_5570_test.py

44 lines
1.4 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-25 22:55:48 +01:00
"""
ID: issue-5837
ISSUE: 5837
TITLE: Negative infinity (double) shown incorrectly without sign in isql
DESCRIPTION:
Bug was in ISQL. We do insert in the table with two DP fields special values which
are "-1.#INF" and "1.#INF" (at least in such view they are represented in the trace).
These values are defined in Python class Decimal as literals '-Infinity' and 'Infinity'.
After this we try to query this table. Expected result: "minus" sign should be shown
leftside of negative infinity.
JIRA: CORE-5570
FBTEST: bugs.core_5570
2022-01-25 22:55:48 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
from decimal import Decimal
2022-01-25 22:55:48 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
recreate table test(x double precision, y double precision);
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
db = db_factory(init=init_script)
2022-01-25 22:55:48 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
X -Infinity
Y Infinity
Records affected: 1
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0.3')
2022-01-25 22:55:48 +01:00
def test_1(act: Action):
with act.db.connect() as con:
c = con.cursor()
c.execute('insert into test(x, y) values(?, ?)', [Decimal('-Infinity'), Decimal('Infinity')])
con.commit()
2022-01-25 22:55:48 +01:00
act.expected_stdout = expected_stdout
act.isql(switches=[], input="set list on; set count on; select * from test;")
assert act.clean_stdout == act.clean_expected_stdout