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
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_5570
|
2022-01-25 22:55:48 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
import pytest
|
2021-12-09 19:26:42 +01:00
|
|
|
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)
|
2021-12-09 19:26:42 +01:00
|
|
|
|
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-12-09 19:26:42 +01:00
|
|
|
"""
|
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:
|
2021-12-09 19:26:42 +01:00
|
|
|
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
|