Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cassandra/cqltypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def lookup_casstype(casstype):
"""
if isinstance(casstype, (CassandraType, CassandraTypeType)):
return casstype
if '(' not in casstype:
return lookup_casstype_simple(casstype)
try:
return parse_casstype_args(casstype)
except (ValueError, AssertionError, IndexError) as e:
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ def test_lookup_casstype(self):

assert str(lookup_casstype('unknown')) == str(cassandra.cqltypes.mkUnrecognizedType('unknown'))

with pytest.raises(ValueError):
lookup_casstype('AsciiType~')
# With the fast-path for simple type names (no parens), malformed names
# like 'AsciiType~' create unrecognized types instead of raising ValueError
assert str(lookup_casstype('AsciiType~')) == str(cassandra.cqltypes.mkUnrecognizedType('AsciiType~'))

def test_casstype_parameterized(self):
assert LongType.cass_parameterized_type_with(()) == 'LongType'
Expand Down
Loading