mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-22 07:42:16 +00:00
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
# Copyright 2023-present ScyllaDB
|
|
#
|
|
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
|
|
|
|
# A collection of tests for grammar that should be rejected, but wasn't at
|
|
# some point in the past.
|
|
|
|
import pytest
|
|
from .util import new_test_table
|
|
from cassandra.protocol import SyntaxException
|
|
|
|
|
|
# table1 is just there so we can execute bad queries against it.
|
|
@pytest.fixture(scope="module")
|
|
def table1(cql, test_keyspace):
|
|
with new_test_table(cql, test_keyspace, "p int, c int, v int, PRIMARY KEY (p, c)") as table:
|
|
yield table
|
|
|
|
# LIMIT should be followed by an expression (#14705)
|
|
def test_limit_empty(cql, table1):
|
|
with pytest.raises(SyntaxException):
|
|
cql.execute(f'SELECT * FROM {table1} LIMIT')
|
|
with pytest.raises(SyntaxException):
|
|
cql.execute(f'SELECT * FROM {table1} PER PARTITION LIMIT')
|
|
|
|
# INSERT JSON should require a JSON value
|
|
# Reproduces https://github.com/scylladb/scylladb/issues/14709
|
|
def test_json_empty(cql, table1):
|
|
with pytest.raises(SyntaxException):
|
|
cql.execute(f'INSERT INTO {table1} JSON')
|