Skip to content

Commit 986b6a7

Browse files
committed
Remove u'' string prefixes from test code
On Python 3, the u'' prefix is a no-op since all strings are already unicode. These prefixes were left over from Python 2 compatibility. Removed 67 u-prefix occurrences across 9 test files: - tests/unit/test_types.py (3) - tests/unit/test_orderedmap.py (3) - tests/unit/test_marshalling.py (6) - tests/unit/test_metadata.py (27) - tests/integration/standard/test_types.py (4) - tests/integration/standard/test_query.py (13) - tests/integration/standard/test_cluster.py (8) - tests/integration/cqlengine/model/test_udts.py (1) - tests/integration/cqlengine/model/test_model_io.py (2) All 608 unit tests pass.
1 parent ccf3d34 commit 986b6a7

9 files changed

Lines changed: 598 additions & 291 deletions

File tree

tests/integration/cqlengine/model/test_model_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,9 @@ def setUp(self):
694694
def test_query_with_date(self):
695695
uid = uuid4()
696696
day = date(2013, 11, 26)
697-
obj = TestQueryModel.create(test_id=uid, date=day, description=u'foo')
697+
obj = TestQueryModel.create(test_id=uid, date=day, description='foo')
698698

699-
assert obj.description == u'foo'
699+
assert obj.description == 'foo'
700700

701701
inst = TestQueryModel.filter(
702702
TestQueryModel.test_id == uid,

tests/integration/cqlengine/model/test_udts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def test_udts_with_unicode(self):
383383
@test_category data_types:udt
384384
"""
385385
ascii_name = 'normal name'
386-
unicode_name = u'Fran\u00E7ois'
386+
unicode_name = 'Fran\u00E7ois'
387387

388388
class UserModelText(Model):
389389
id = columns.Text(primary_key=True)

tests/integration/standard/test_cluster.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,14 +1267,14 @@ def test_compact_option(self):
12671267
"({i}, 'a{i}{i}', {i}{i}, {i}{i}, textAsBlob('b{i}{i}'))".format(i=i))
12681268

12691269
nc_results = nc_session.execute("SELECT * FROM compact_table")
1270-
assert set(nc_results.current_rows) == {(1, u'a1', 11, 11, 'b1'),
1271-
(1, u'a11', 11, 11, 'b11'),
1272-
(2, u'a2', 22, 22, 'b2'),
1273-
(2, u'a22', 22, 22, 'b22'),
1274-
(3, u'a3', 33, 33, 'b3'),
1275-
(3, u'a33', 33, 33, 'b33'),
1276-
(4, u'a4', 44, 44, 'b4'),
1277-
(4, u'a44', 44, 44, 'b44')}
1270+
assert set(nc_results.current_rows) == {(1, 'a1', 11, 11, 'b1'),
1271+
(1, 'a11', 11, 11, 'b11'),
1272+
(2, 'a2', 22, 22, 'b2'),
1273+
(2, 'a22', 22, 22, 'b22'),
1274+
(3, 'a3', 33, 33, 'b3'),
1275+
(3, 'a33', 33, 33, 'b33'),
1276+
(4, 'a4', 44, 44, 'b4'),
1277+
(4, 'a44', 44, 44, 'b44')}
12781278

12791279
results = session.execute("SELECT * FROM compact_table")
12801280
assert set(results.current_rows) == {(1, 11, 11),

tests/integration/standard/test_query.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def test_column_names(self):
323323
result_set = self.session.execute("SELECT * FROM {0}.{1}".format(self.keyspace_name, self.function_table_name))
324324
assert result_set.column_types is not None
325325

326-
assert result_set.column_names == [u'user', u'game', u'year', u'month', u'day', u'score']
326+
assert result_set.column_names == ['user', 'game', 'year', 'month', 'day', 'score']
327327

328328
@greaterthanorequalcass30
329329
def test_basic_json_query(self):
@@ -759,11 +759,11 @@ def test_unicode(self):
759759
k int PRIMARY KEY,
760760
v text )'''
761761
self.session.execute(ddl)
762-
unicode_text = u'Fran\u00E7ois'
763-
query = u'INSERT INTO test3rf.testtext (k, v) VALUES (%s, %s)'
762+
unicode_text = 'Fran\u00E7ois'
763+
query = 'INSERT INTO test3rf.testtext (k, v) VALUES (%s, %s)'
764764
try:
765765
batch = BatchStatement(BatchType.LOGGED)
766-
batch.add(u"INSERT INTO test3rf.testtext (k, v) VALUES (%s, %s)", (0, unicode_text))
766+
batch.add("INSERT INTO test3rf.testtext (k, v) VALUES (%s, %s)", (0, unicode_text))
767767
self.session.execute(batch)
768768
finally:
769769
self.session.execute("DROP TABLE test3rf.testtext")
@@ -1338,12 +1338,12 @@ def test_unicode(self):
13381338
@test_category query
13391339
"""
13401340

1341-
unicode_text = u'Fran\u00E7ois'
1341+
unicode_text = 'Fran\u00E7ois'
13421342
batch = BatchStatement(BatchType.LOGGED)
1343-
batch.add(u"INSERT INTO {0}.{1} (k, v) VALUES (%s, %s)".format(self.keyspace_name, self.function_table_name), (0, unicode_text))
1343+
batch.add("INSERT INTO {0}.{1} (k, v) VALUES (%s, %s)".format(self.keyspace_name, self.function_table_name), (0, unicode_text))
13441344
self.session.execute(batch)
1345-
self.session.execute(u"INSERT INTO {0}.{1} (k, v) VALUES (%s, %s)".format(self.keyspace_name, self.function_table_name), (0, unicode_text))
1346-
prepared = self.session.prepare(u"INSERT INTO {0}.{1} (k, v) VALUES (?, ?)".format(self.keyspace_name, self.function_table_name))
1345+
self.session.execute("INSERT INTO {0}.{1} (k, v) VALUES (%s, %s)".format(self.keyspace_name, self.function_table_name), (0, unicode_text))
1346+
prepared = self.session.prepare("INSERT INTO {0}.{1} (k, v) VALUES (?, ?)".format(self.keyspace_name, self.function_table_name))
13471347
bound = prepared.bind((1, unicode_text))
13481348
self.session.execute(bound)
13491349

0 commit comments

Comments
 (0)