Skip to content

Commit

Permalink
Move dynamber to sql tests (#12932)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximyurchuk authored Dec 24, 2024
1 parent 3096657 commit ed24bb6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 45 deletions.
28 changes: 0 additions & 28 deletions ydb/tests/functional/dynumber/test_dynumber.py

This file was deleted.

15 changes: 0 additions & 15 deletions ydb/tests/functional/dynumber/ya.make

This file was deleted.

1 change: 0 additions & 1 deletion ydb/tests/functional/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ RECURSE(
cms
compatibility
config
dynumber
encryption
hive
kqp
Expand Down
31 changes: 30 additions & 1 deletion ydb/tests/sql/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def teardown_class(cls):
def setup(self):
current_test_full_name = os.environ.get("PYTEST_CURRENT_TEST")
self.table_path = "table_" + current_test_full_name.replace("::", ".").removesuffix(" (setup)")
print(self.table_path)

def test_minimal_maximal_values(self):
"""
Expand Down Expand Up @@ -76,3 +75,33 @@ def test_minimal_maximal_values(self):
assert len(rows) == 1, "Expected one row"
assert rows[0].id == 1, "ID does not match"
assert rows[0].value == value, "Value does not match"

def test_dynumber(self):
table_name = "{}/{}".format(self.table_path, "dynamber")
self.pool.execute_with_retries(
f"""
CREATE TABLE `{table_name}` (
id DyNumber,
PRIMARY KEY (id)
);"""
)

self.pool.execute_with_retries(
f"""
UPSERT INTO `{table_name}` (id)
VALUES
(DyNumber(".149e4")),
(DyNumber("15e2")),
(DyNumber("150e1")), -- same as 15e2
(DyNumber("151e4")),
(DyNumber("1500.1"));
"""
)

result = self.pool.execute_with_retries(
f"""
SELECT count(*) FROM `{table_name}`;
"""
)

assert result[0].rows[0][0] == 4

0 comments on commit ed24bb6

Please sign in to comment.