Skip to content

Commit

Permalink
test/cqlpy: add from_string vector test
Browse files Browse the repository at this point in the history
Motivation for this test was to show that from_string functionality
can be accesed via CQL.
  • Loading branch information
QuerthDP committed Dec 28, 2024
1 parent 9e3bcb4 commit fae9759
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/cqlpy/test_from_string.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024-present ScyllaDB
#
# SPDX-License-Identifier: AGPL-3.0-or-later

import pytest
from .util import unique_name


# Test that we can insert a vector from a string.
# This is marked as scylla-only because Apache Cassandra does not support
# such from_string syntax, but we want to have compatible string format
# in both our from_string and to_string functions.
# Please check abstract_type::to_string for reference.
def test_vector_from_string(cql, test_keyspace, scylla_only):
table = test_keyspace + "." + unique_name()
cql.execute(f"CREATE TABLE {table} (pk int primary key, v vector<int, 3>)")
cql.execute(f"INSERT INTO {table} (pk, v) VALUES (1, '1, 2, 3')")
assert cql.execute(f"SELECT v FROM {table} WHERE pk=1").one().v == [1, 2, 3]

0 comments on commit fae9759

Please sign in to comment.