Skip to content

Commit 055a9dd

Browse files
committed
remove: dead unichr() code blocks guarded by Python 2 version check
- test_validation.py: remove 'if sys.version_info < (3, 1)' blocks that tested unichr() (only available in Python 2). Also fix 'class DataType():' to 'class DataType:'. - test_metadata.py: delete test_export_keyspace_schema_udts which was skipped on all Python versions except 2.7.
1 parent d867a44 commit 055a9dd

2 files changed

Lines changed: 1 addition & 82 deletions

File tree

tests/integration/cqlengine/columns/test_validation.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def test_varint_io(self):
190190
self.VarIntTest.objects.create(test_id=0, bignum="not_a_number")
191191

192192

193-
class DataType():
193+
class DataType:
194194
@classmethod
195195
def setUpClass(cls):
196196
if PROTOCOL_VERSION < 4 or CASSANDRA_VERSION < Version("3.0"):
@@ -611,9 +611,6 @@ def test_type_checking(self):
611611
with pytest.raises(ValidationError):
612612
Ascii().validate('Beyonc' + chr(233))
613613

614-
if sys.version_info < (3, 1):
615-
with pytest.raises(ValidationError):
616-
Ascii().validate('Beyonc' + unichr(233))
617614

618615
def test_unaltering_validation(self):
619616
""" Test the validation step doesn't re-interpret values. """
@@ -735,8 +732,6 @@ def test_type_checking(self):
735732

736733
Text().validate("!#$%&\'()*+,-./")
737734
Text().validate('Beyonc' + chr(233))
738-
if sys.version_info < (3, 1):
739-
Text().validate('Beyonc' + unichr(233))
740735

741736
def test_unaltering_validation(self):
742737
""" Test the validation step doesn't re-interpret values. """

tests/integration/standard/test_metadata.py

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,82 +1119,6 @@ def test_export_keyspace_schema(self):
11191119
assert isinstance(keyspace_metadata.as_cql_query(), str)
11201120
cluster.shutdown()
11211121

1122-
@greaterthancass20
1123-
def test_export_keyspace_schema_udts(self):
1124-
"""
1125-
Test udt exports
1126-
"""
1127-
1128-
if PROTOCOL_VERSION < 3:
1129-
raise unittest.SkipTest(
1130-
"Protocol 3.0+ is required for UDT change events, currently testing against %r"
1131-
% (PROTOCOL_VERSION,))
1132-
1133-
if sys.version_info[0:2] != (2, 7):
1134-
raise unittest.SkipTest('This test compares static strings generated from dict items, which may change orders. Test with 2.7.')
1135-
1136-
cluster = TestCluster()
1137-
session = cluster.connect()
1138-
1139-
session.execute("""
1140-
CREATE KEYSPACE export_udts
1141-
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
1142-
AND durable_writes = true;
1143-
""")
1144-
session.execute("""
1145-
CREATE TYPE export_udts.street (
1146-
street_number int,
1147-
street_name text)
1148-
""")
1149-
session.execute("""
1150-
CREATE TYPE export_udts.zip (
1151-
zipcode int,
1152-
zip_plus_4 int)
1153-
""")
1154-
session.execute("""
1155-
CREATE TYPE export_udts.address (
1156-
street_address frozen<street>,
1157-
zip_code frozen<zip>)
1158-
""")
1159-
session.execute("""
1160-
CREATE TABLE export_udts.users (
1161-
user text PRIMARY KEY,
1162-
addresses map<text, frozen<address>>)
1163-
""")
1164-
1165-
expected_prefix = """CREATE KEYSPACE export_udts WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;
1166-
1167-
CREATE TYPE export_udts.street (
1168-
street_number int,
1169-
street_name text
1170-
);
1171-
1172-
CREATE TYPE export_udts.zip (
1173-
zipcode int,
1174-
zip_plus_4 int
1175-
);
1176-
1177-
CREATE TYPE export_udts.address (
1178-
street_address frozen<street>,
1179-
zip_code frozen<zip>
1180-
);
1181-
1182-
CREATE TABLE export_udts.users (
1183-
user text PRIMARY KEY,
1184-
addresses map<text, frozen<address>>"""
1185-
1186-
assert_startswith_diff(cluster.metadata.keyspaces['export_udts'].export_as_string(), expected_prefix)
1187-
1188-
table_meta = cluster.metadata.keyspaces['export_udts'].tables['users']
1189-
1190-
expected_prefix = """CREATE TABLE export_udts.users (
1191-
user text PRIMARY KEY,
1192-
addresses map<text, frozen<address>>"""
1193-
1194-
assert_startswith_diff(table_meta.export_as_string(), expected_prefix)
1195-
1196-
cluster.shutdown()
1197-
11981122
@greaterthancass21
11991123
@xfail_scylla_version_lt(reason='scylladb/scylladb#10707 - Column name in CREATE INDEX is not quoted',
12001124
oss_scylla_version="5.2", ent_scylla_version="2023.1.1")

0 commit comments

Comments
 (0)