mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-02 13:06:57 +00:00
test/cql-pytest: move aggregation tests to one file
We had separate test files test_minmax.py and test_count.py but the separate was artificial (and test_count.py even had one test using min()). Now I that want to add another test for sum(), I don't know where to put it. So in this patch I combine test_minmax.py and test_count.py into one test file - test_aggregate.py, and we can later add sum() tests in the same file. Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
# Copyright 2023-present ScyllaDB
|
||||
# Copyright 2021-present ScyllaDB
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
#############################################################################
|
||||
# Tests for the COUNT() aggregation function
|
||||
# Tests aggregation functions COUNT(), MIN(), MAX(), SUM()
|
||||
#############################################################################
|
||||
|
||||
import pytest
|
||||
from util import new_test_table, unique_key_int
|
||||
from util import new_test_table, unique_key_int, project
|
||||
from cassandra.util import Date
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def table1(cql, test_keyspace):
|
||||
@@ -96,3 +97,14 @@ def test_count_and_group_by_row_none(cql, table1):
|
||||
def test_count_and_group_by_partition_none(cql, table1):
|
||||
p = unique_key_int()
|
||||
assert [] == list(cql.execute(f"select p, count(v) from {table1} where p = {p} group by p"))
|
||||
|
||||
# Regression-test for #7729.
|
||||
def test_timeuuid(cql, test_keyspace):
|
||||
schema = "a int, b timeuuid, primary key (a,b)"
|
||||
with new_test_table(cql, test_keyspace, schema) as table:
|
||||
cql.execute(f'insert into {table} (a, b) values (0, 13814000-1dd2-11ff-8080-808080808080)')
|
||||
cql.execute(f'insert into {table} (a, b) values (0, 6b1b3620-33fd-11eb-8080-808080808080)')
|
||||
assert project('system_todate_system_min_b',
|
||||
cql.execute(f'select todate(min(b)) from {table} where a = 0')) == [Date('2020-12-01')]
|
||||
assert project('system_todate_system_max_b',
|
||||
cql.execute(f'select todate(max(b)) from {table} where a = 0')) == [Date('2038-09-06')]
|
||||
@@ -1,23 +0,0 @@
|
||||
# Copyright 2021-present ScyllaDB
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
#############################################################################
|
||||
# Tests for min/max aggregate functions
|
||||
#############################################################################
|
||||
|
||||
import pytest
|
||||
from cassandra.protocol import SyntaxException, AlreadyExists, InvalidRequest, ConfigurationException, ReadFailure
|
||||
from cassandra.util import Date
|
||||
from util import unique_name, new_test_table, project
|
||||
|
||||
# Regression-test for #7729.
|
||||
def test_timeuuid(cql, test_keyspace):
|
||||
schema = "a int, b timeuuid, primary key (a,b)"
|
||||
with new_test_table(cql, test_keyspace, schema) as table:
|
||||
cql.execute(f'insert into {table} (a, b) values (0, 13814000-1dd2-11ff-8080-808080808080)')
|
||||
cql.execute(f'insert into {table} (a, b) values (0, 6b1b3620-33fd-11eb-8080-808080808080)')
|
||||
assert project('system_todate_system_min_b',
|
||||
cql.execute(f'select todate(min(b)) from {table} where a = 0')) == [Date('2020-12-01')]
|
||||
assert project('system_todate_system_max_b',
|
||||
cql.execute(f'select todate(max(b)) from {table} where a = 0')) == [Date('2038-09-06')]
|
||||
Reference in New Issue
Block a user