cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aweisb...@apache.org
Subject [2/3] cassandra-dtest git commit: pytest/python 3 dtests breaks tests on 3.0 and 3.11
Date Wed, 07 Feb 2018 18:15:56 GMT
http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/7c05a111/thrift_test.py
----------------------------------------------------------------------
diff --git a/thrift_test.py b/thrift_test.py
index 23e3f7b..0990d71 100644
--- a/thrift_test.py
+++ b/thrift_test.py
@@ -4,6 +4,7 @@ import time
 import uuid
 import pytest
 import logging
+import codecs
 
 from thrift.protocol import TBinaryProtocol
 from thrift.Thrift import TApplicationException
@@ -31,7 +32,9 @@ from tools.assertions import (assert_all, assert_none, assert_one)
 
 since = pytest.mark.since
 logger = logging.getLogger(__name__)
-
+utf8encoder = codecs.getencoder('utf-8')
+def utf8encode(str):
+    return utf8encoder(str)[0]
 
 def get_thrift_client(host='127.0.0.1', port=9160):
     socket = TSocket.TSocket(host, port)
@@ -66,7 +69,7 @@ class TestThrift(Tester):
         return dtest_setup_overrides
 
     @pytest.fixture(scope='function', autouse=True)
-    def fixture_set_cluster_settings(self, fixture_dtest_setup):
+    def fixture_set_cluster_settings(self, fixture_dtest_setup, set_dtest_setup_on_function):
         fixture_dtest_setup.cluster.populate(1)
         node1, = fixture_dtest_setup.cluster.nodelist()
 
@@ -75,7 +78,7 @@ class TestThrift(Tester):
         # automatically. It does not matter what token we set as we only
         # ever use one node.
         if not self.dtest_config.use_vnodes:
-            node1.set_configuration_options(values={'initial_token': "a".encode('hex')})
+            node1.set_configuration_options(values={'initial_token': 'abcd'})
 
         fixture_dtest_setup.cluster.start(wait_for_binary_proto=True)
         fixture_dtest_setup.cluster.nodelist()[0].watch_log_for("Listening for thrift clients")  # Wait for the thrift port to open
@@ -95,8 +98,8 @@ class TestThrift(Tester):
                                     cf_defs=[
             Cassandra.CfDef('Keyspace1', 'Standard1'),
             Cassandra.CfDef('Keyspace1', 'Standard2'),
-            Cassandra.CfDef('Keyspace1', 'Standard3', column_metadata=[Cassandra.ColumnDef('c1', 'AsciiType'), Cassandra.ColumnDef('c2', 'AsciiType')]),
-            Cassandra.CfDef('Keyspace1', 'Standard4', column_metadata=[Cassandra.ColumnDef('c1', 'AsciiType')]),
+            Cassandra.CfDef('Keyspace1', 'Standard3', column_metadata=[Cassandra.ColumnDef(utf8encode('c1'), 'AsciiType'), Cassandra.ColumnDef(utf8encode('c2'), 'AsciiType')]),
+            Cassandra.CfDef('Keyspace1', 'Standard4', column_metadata=[Cassandra.ColumnDef(utf8encode('c1'), 'AsciiType')]),
             Cassandra.CfDef('Keyspace1', 'StandardLong1', comparator_type='LongType'),
             Cassandra.CfDef('Keyspace1', 'StandardInteger1', comparator_type='IntegerType'),
             Cassandra.CfDef('Keyspace1', 'StandardComposite', comparator_type='CompositeType(AsciiType, AsciiType)'),
@@ -105,10 +108,10 @@ class TestThrift(Tester):
             Cassandra.CfDef('Keyspace1', 'Super3', column_type='Super', comparator_type='LongType', subcomparator_type='UTF8Type'),
             Cassandra.CfDef('Keyspace1', 'Counter1', default_validation_class='CounterColumnType'),
             Cassandra.CfDef('Keyspace1', 'SuperCounter1', column_type='Super', default_validation_class='CounterColumnType'),
-            Cassandra.CfDef('Keyspace1', 'Indexed1', column_metadata=[Cassandra.ColumnDef('birthdate', 'LongType', Cassandra.IndexType.KEYS, 'birthdate_index')]),
+            Cassandra.CfDef('Keyspace1', 'Indexed1', column_metadata=[Cassandra.ColumnDef(utf8encode('birthdate'), 'LongType', Cassandra.IndexType.KEYS, 'birthdate_index')]),
             Cassandra.CfDef('Keyspace1', 'Indexed2', comparator_type='TimeUUIDType', column_metadata=[Cassandra.ColumnDef(uuid.UUID('00000000-0000-1000-0000-000000000000').bytes, 'LongType', Cassandra.IndexType.KEYS)]),
             Cassandra.CfDef('Keyspace1', 'Indexed3', comparator_type='TimeUUIDType', column_metadata=[Cassandra.ColumnDef(uuid.UUID('00000000-0000-1000-0000-000000000000').bytes, 'UTF8Type', Cassandra.IndexType.KEYS)]),
-            Cassandra.CfDef('Keyspace1', 'Indexed4', column_metadata=[Cassandra.ColumnDef('a', 'LongType', Cassandra.IndexType.KEYS, 'a_index'), Cassandra.ColumnDef('z', 'UTF8Type')]),
+            Cassandra.CfDef('Keyspace1', 'Indexed4', column_metadata=[Cassandra.ColumnDef(utf8encode('a'), 'LongType', Cassandra.IndexType.KEYS, 'a_index'), Cassandra.ColumnDef(utf8encode('z'), 'UTF8Type')]),
             Cassandra.CfDef('Keyspace1', 'Expiring', default_time_to_live=2)
         ])
 
@@ -120,7 +123,7 @@ class TestThrift(Tester):
                                         Cassandra.CfDef('Keyspace2', 'Super4', column_type='Super', subcomparator_type='TimeUUIDType'), ])
 
         for ks in [keyspace1, keyspace2]:
-            cls.client.system_add_keyspace(ks)
+            client.system_add_keyspace(ks)
 
 
 def i64(n):
@@ -135,7 +138,12 @@ def i16(n):
     return _i16(n)
 
 
-def composite(item1, item2=None, eoc='\x00'):
+def composite(item1, item2=None, eoc=b'\x00'):
+    if isinstance(item1, str):
+        item1 = utf8encode(item1)
+    if isinstance(item2, str):
+        item2 = utf8encode(item2)
+
     packed = _i16(len(item1)) + item1 + eoc
     if item2 is not None:
         packed += _i16(len(item2)) + item2
@@ -155,14 +163,19 @@ def _i16(n):
     return struct.pack('>h', n)  # big endian = network order
 
 
-_SIMPLE_COLUMNS = [Column('c1', 'value1', 0),
-                   Column('c2', 'value2', 0)]
-_SUPER_COLUMNS = [SuperColumn(name='sc1', columns=[Column(_i64(4), 'value4', 0)]),
-                  SuperColumn(name='sc2', columns=[Column(_i64(5), 'value5', 0),
-                                                   Column(_i64(6), 'value6', 0)])]
+_SIMPLE_COLUMNS = [Column(utf8encode('c1'), utf8encode('value1'), 0),
+                   Column(utf8encode('c2'), utf8encode('value2'), 0)]
+_SUPER_COLUMNS = [SuperColumn(name=utf8encode('sc1'), columns=[Column(_i64(4), utf8encode('value4'), 0)]),
+                  SuperColumn(name=utf8encode('sc2'), columns=[Column(_i64(5), utf8encode('value5'), 0),
+                                                   Column(_i64(6), utf8encode('value6'), 0)])]
 
 
 def _assert_column(column_family, key, column, value, ts=0):
+    if isinstance(key, str):
+        key = utf8encode(key)
+    if isinstance(value, str):
+        value = utf8encode(value)
+
     try:
         assert client.get(key, ColumnPath(column_family, column=column), ConsistencyLevel.ONE).column == Column(column, value, ts)
     except NotFoundException:
@@ -170,6 +183,8 @@ def _assert_column(column_family, key, column, value, ts=0):
 
 
 def _assert_columnpath_exists(key, column_path):
+    if isinstance(key, str):
+        key = utf8encode(key)
     try:
         assert client.get(key, column_path, ConsistencyLevel.ONE)
     except NotFoundException:
@@ -177,6 +192,8 @@ def _assert_columnpath_exists(key, column_path):
 
 
 def _assert_no_columnpath(key, column_path):
+    if isinstance(key, str):
+        key = utf8encode(key)
     try:
         client.get(key, column_path, ConsistencyLevel.ONE)
         assert False, ('columnpath %s existed in %s when it should not' % (column_path, key))
@@ -185,77 +202,83 @@ def _assert_no_columnpath(key, column_path):
 
 
 def _insert_simple():
-    return _insert_multi(['key1'])
+    return _insert_multi([utf8encode('key1')])
 
 
 def _insert_multi(keys):
     CL = ConsistencyLevel.ONE
     for key in keys:
-        client.insert(key, ColumnParent('Standard1'), Column('c1', 'value1', 0), CL)
-        client.insert(key, ColumnParent('Standard1'), Column('c2', 'value2', 0), CL)
+        if isinstance(key, str):
+            key = utf8encode(key)
+        client.insert(key, ColumnParent('Standard1'), Column(utf8encode('c1'), utf8encode('value1'), 0), CL)
+        client.insert(key, ColumnParent('Standard1'), Column(utf8encode('c2'), utf8encode('value2'), 0), CL)
 
 
 def _insert_batch():
     cfmap = {'Standard1': [Mutation(ColumnOrSuperColumn(c)) for c in _SIMPLE_COLUMNS],
              'Standard2': [Mutation(ColumnOrSuperColumn(c)) for c in _SIMPLE_COLUMNS]}
-    client.batch_mutate({'key1': cfmap}, ConsistencyLevel.ONE)
+    client.batch_mutate({utf8encode('key1'): cfmap}, ConsistencyLevel.ONE)
 
 
 def _big_slice(key, column_parent):
-    p = SlicePredicate(slice_range=SliceRange('', '', False, 1000))
+    if isinstance(key, str):
+        key = utf8encode(key)
+    p = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 1000))
     return client.get_slice(key, column_parent, p, ConsistencyLevel.ONE)
 
 
 def _big_multislice(keys, column_parent):
-    p = SlicePredicate(slice_range=SliceRange('', '', False, 1000))
+    p = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 1000))
     return client.multiget_slice(keys, column_parent, p, ConsistencyLevel.ONE)
 
 
 def _verify_batch():
     _verify_simple()
     L = [result.column
-         for result in _big_slice('key1', ColumnParent('Standard2'))]
+         for result in _big_slice(utf8encode('key1'), ColumnParent('Standard2'))]
     assert L == _SIMPLE_COLUMNS, L
 
 
 def _verify_simple():
-    assert client.get('key1', ColumnPath('Standard1', column='c1'), ConsistencyLevel.ONE).column == Column('c1', 'value1', 0)
+    assert client.get(utf8encode('key1'), ColumnPath('Standard1', column=utf8encode('c1')), ConsistencyLevel.ONE).column == Column(utf8encode('c1'), utf8encode('value1'), 0)
     L = [result.column
-         for result in _big_slice('key1', ColumnParent('Standard1'))]
+         for result in _big_slice(utf8encode('key1'), ColumnParent('Standard1'))]
     assert L == _SIMPLE_COLUMNS, L
 
 
 def _insert_super(key='key1'):
-    client.insert(key, ColumnParent('Super1', 'sc1'), Column(_i64(4), 'value4', 0), ConsistencyLevel.ONE)
-    client.insert(key, ColumnParent('Super1', 'sc2'), Column(_i64(5), 'value5', 0), ConsistencyLevel.ONE)
-    client.insert(key, ColumnParent('Super1', 'sc2'), Column(_i64(6), 'value6', 0), ConsistencyLevel.ONE)
+    if isinstance(key, str):
+        key = utf8encode(key)
+    client.insert(key, ColumnParent('Super1', utf8encode('sc1')), Column(_i64(4), utf8encode('value4'), 0), ConsistencyLevel.ONE)
+    client.insert(key, ColumnParent('Super1', utf8encode('sc2')), Column(_i64(5), utf8encode('value5'), 0), ConsistencyLevel.ONE)
+    client.insert(key, ColumnParent('Super1', utf8encode('sc2')), Column(_i64(6), utf8encode('value6'), 0), ConsistencyLevel.ONE)
 
 
 def _insert_range():
-    client.insert('key1', ColumnParent('Standard1'), Column('c1', 'value1', 0), ConsistencyLevel.ONE)
-    client.insert('key1', ColumnParent('Standard1'), Column('c2', 'value2', 0), ConsistencyLevel.ONE)
-    client.insert('key1', ColumnParent('Standard1'), Column('c3', 'value3', 0), ConsistencyLevel.ONE)
+    client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c1'), utf8encode('value1'), 0), ConsistencyLevel.ONE)
+    client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c2'), utf8encode('value2'), 0), ConsistencyLevel.ONE)
+    client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c3'), utf8encode('value3'), 0), ConsistencyLevel.ONE)
 
 
 def _verify_range():
-    p = SlicePredicate(slice_range=SliceRange('c1', 'c2', False, 1000))
-    result = client.get_slice('key1', ColumnParent('Standard1'), p, ConsistencyLevel.ONE)
+    p = SlicePredicate(slice_range=SliceRange(utf8encode('c1'), utf8encode('c2'), False, 1000))
+    result = client.get_slice(utf8encode('key1'), ColumnParent('Standard1'), p, ConsistencyLevel.ONE)
     assert len(result) == 2
-    assert result[0].column.name == 'c1'
-    assert result[1].column.name == 'c2'
+    assert result[0].column.name == utf8encode('c1')
+    assert result[1].column.name == utf8encode('c2')
 
-    p = SlicePredicate(slice_range=SliceRange('c3', 'c2', True, 1000))
-    result = client.get_slice('key1', ColumnParent('Standard1'), p, ConsistencyLevel.ONE)
+    p = SlicePredicate(slice_range=SliceRange(utf8encode('c3'), utf8encode('c2'), True, 1000))
+    result = client.get_slice(utf8encode('key1'), ColumnParent('Standard1'), p, ConsistencyLevel.ONE)
     assert len(result) == 2
-    assert result[0].column.name == 'c3'
-    assert result[1].column.name == 'c2'
+    assert result[0].column.name == utf8encode('c3')
+    assert result[1].column.name == utf8encode('c2')
 
-    p = SlicePredicate(slice_range=SliceRange('a', 'z', False, 1000))
-    result = client.get_slice('key1', ColumnParent('Standard1'), p, ConsistencyLevel.ONE)
+    p = SlicePredicate(slice_range=SliceRange(utf8encode('a'), utf8encode('z'), False, 1000))
+    result = client.get_slice(utf8encode('key1'), ColumnParent('Standard1'), p, ConsistencyLevel.ONE)
     assert len(result) == 3, result
 
-    p = SlicePredicate(slice_range=SliceRange('a', 'z', False, 2))
-    result = client.get_slice('key1', ColumnParent('Standard1'), p, ConsistencyLevel.ONE)
+    p = SlicePredicate(slice_range=SliceRange(utf8encode('a'), utf8encode('z'), False, 2))
+    result = client.get_slice(utf8encode('key1'), ColumnParent('Standard1'), p, ConsistencyLevel.ONE)
     assert len(result) == 2, result
 
 
@@ -264,29 +287,31 @@ def _set_keyspace(keyspace):
 
 
 def _insert_super_range():
-    client.insert('key1', ColumnParent('Super1', 'sc1'), Column(_i64(4), 'value4', 0), ConsistencyLevel.ONE)
-    client.insert('key1', ColumnParent('Super1', 'sc2'), Column(_i64(5), 'value5', 0), ConsistencyLevel.ONE)
-    client.insert('key1', ColumnParent('Super1', 'sc2'), Column(_i64(6), 'value6', 0), ConsistencyLevel.ONE)
-    client.insert('key1', ColumnParent('Super1', 'sc3'), Column(_i64(7), 'value7', 0), ConsistencyLevel.ONE)
+    client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc1')), Column(_i64(4), utf8encode('value4'), 0), ConsistencyLevel.ONE)
+    client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')), Column(_i64(5), utf8encode('value5'), 0), ConsistencyLevel.ONE)
+    client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')), Column(_i64(6), utf8encode('value6'), 0), ConsistencyLevel.ONE)
+    client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc3')), Column(_i64(7), utf8encode('value7'), 0), ConsistencyLevel.ONE)
     time.sleep(0.1)
 
 
 def _verify_super_range():
-    p = SlicePredicate(slice_range=SliceRange('sc2', 'sc3', False, 2))
-    result = client.get_slice('key1', ColumnParent('Super1'), p, ConsistencyLevel.ONE)
+    p = SlicePredicate(slice_range=SliceRange(utf8encode('sc2'), utf8encode('sc3'), False, 2))
+    result = client.get_slice(utf8encode('key1'), ColumnParent('Super1'), p, ConsistencyLevel.ONE)
     assert len(result) == 2
-    assert result[0].super_column.name == 'sc2'
-    assert result[1].super_column.name == 'sc3'
+    assert result[0].super_column.name == utf8encode('sc2')
+    assert result[1].super_column.name == utf8encode('sc3')
 
-    p = SlicePredicate(slice_range=SliceRange('sc3', 'sc2', True, 2))
-    result = client.get_slice('key1', ColumnParent('Super1'), p, ConsistencyLevel.ONE)
+    p = SlicePredicate(slice_range=SliceRange(utf8encode('sc3'), utf8encode('sc2'), True, 2))
+    result = client.get_slice(utf8encode('key1'), ColumnParent('Super1'), p, ConsistencyLevel.ONE)
     assert len(result) == 2
-    assert result[0].super_column.name == 'sc3'
-    assert result[1].super_column.name == 'sc2'
+    assert result[0].super_column.name == utf8encode('sc3')
+    assert result[1].super_column.name == utf8encode('sc2')
 
 
 def _verify_super(supercf='Super1', key='key1'):
-    assert client.get(key, ColumnPath(supercf, 'sc1', _i64(4)), ConsistencyLevel.ONE).column == Column(_i64(4), 'value4', 0)
+    if isinstance(key, str):
+        key = utf8encode(key)
+    assert client.get(key, ColumnPath(supercf, utf8encode('sc1'), _i64(4)), ConsistencyLevel.ONE).column == Column(_i64(4), utf8encode('value4'), 0)
     slice = [result.super_column
              for result in _big_slice(key, ColumnParent('Super1'))]
     assert slice == _SUPER_COLUMNS, slice
@@ -311,22 +336,26 @@ def get_range_slice(client, parent, predicate, start, end, count, cl, row_filter
 
 
 def _insert_six_columns(key='abc'):
+    if isinstance(key, str):
+        key = utf8encode(key)
     CL = ConsistencyLevel.ONE
-    client.insert(key, ColumnParent('Standard1'), Column('a', '1', 0), CL)
-    client.insert(key, ColumnParent('Standard1'), Column('b', '2', 0), CL)
-    client.insert(key, ColumnParent('Standard1'), Column('c', '3', 0), CL)
-    client.insert(key, ColumnParent('Standard1'), Column('d', '4', 0), CL)
-    client.insert(key, ColumnParent('Standard1'), Column('e', '5', 0), CL)
-    client.insert(key, ColumnParent('Standard1'), Column('f', '6', 0), CL)
+    client.insert(key, ColumnParent('Standard1'), Column(utf8encode('a'), utf8encode('1'), 0), CL)
+    client.insert(key, ColumnParent('Standard1'), Column(utf8encode('b'), utf8encode('2'), 0), CL)
+    client.insert(key, ColumnParent('Standard1'), Column(utf8encode('c'), utf8encode('3'), 0), CL)
+    client.insert(key, ColumnParent('Standard1'), Column(utf8encode('d'), utf8encode('4'), 0), CL)
+    client.insert(key, ColumnParent('Standard1'), Column(utf8encode('e'), utf8encode('5'), 0), CL)
+    client.insert(key, ColumnParent('Standard1'), Column(utf8encode('f'), utf8encode('6'), 0), CL)
 
 
 def _big_multi_slice(key='abc'):
+    if isinstance(key, str):
+        key = utf8encode(key)
     c1 = ColumnSlice()
-    c1.start = 'a'
-    c1.finish = 'c'
+    c1.start = utf8encode('a')
+    c1.finish = utf8encode('c')
     c2 = ColumnSlice()
-    c2.start = 'e'
-    c2.finish = 'f'
+    c2.start = utf8encode('e')
+    c2.finish = utf8encode('f')
     m = MultiSliceRequest()
     m.key = key
     m.column_parent = ColumnParent('Standard1')
@@ -337,7 +366,7 @@ def _big_multi_slice(key='abc'):
     return client.get_multi_slice(m)
 
 
-_MULTI_SLICE_COLUMNS = [Column('a', '1', 0), Column('b', '2', 0), Column('c', '3', 0), Column('e', '5', 0), Column('f', '6', 0)]
+_MULTI_SLICE_COLUMNS = [Column(utf8encode('a'), utf8encode('1'), 0), Column(utf8encode('b'), utf8encode('2'), 0), Column(utf8encode('c'), utf8encode('3'), 0), Column(utf8encode('e'), utf8encode('5'), 0), Column(utf8encode('f'), utf8encode('6'), 0)]
 
 
 @since('2.0', max_version='4')
@@ -356,15 +385,15 @@ class TestMutations(TestThrift):
     def test_empty_slice(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Standard2', 'Super1')
-        assert _big_slice('key1', ColumnParent('Standard2')) == []
-        assert _big_slice('key1', ColumnParent('Super1')) == []
+        assert _big_slice(utf8encode('key1'), ColumnParent('Standard2')) == []
+        assert _big_slice(utf8encode('key1'), ColumnParent('Super1')) == []
 
     def test_cas(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Standard1', 'Standard3', 'Standard4')
 
         def cas(expected, updates, column_family):
-            return client.cas('key1', column_family, expected, updates, ConsistencyLevel.SERIAL, ConsistencyLevel.QUORUM)
+            return client.cas(utf8encode('key1'), column_family, expected, updates, ConsistencyLevel.SERIAL, ConsistencyLevel.QUORUM)
 
         def test_cas_operations(first_columns, second_columns, column_family):
             # partition should be empty, so cas expecting any existing values should fail
@@ -375,7 +404,7 @@ class TestMutations(TestThrift):
             # cas of empty columns -> first_columns should succeed
             # and the reading back from the table should match first_columns
             assert cas([], first_columns, column_family).success
-            result = [cosc.column for cosc in _big_slice('key1', ColumnParent(column_family))]
+            result = [cosc.column for cosc in _big_slice(utf8encode('key1'), ColumnParent(column_family))]
             # CAS will use its own timestamp, so we can't just compare result == _SIMPLE_COLUMNS
             assert dict((c.name, c.value) for c in result) == dict((ex.name, ex.value) for ex in first_columns)
 
@@ -387,7 +416,7 @@ class TestMutations(TestThrift):
             assert dict((c.name, c.value) for c in cas_result.current_values) == {first_columns[0].name: first_columns[0].value}, cas_result
 
             # CL.SERIAL for reads
-            assert client.get('key1', ColumnPath(column_family, column=first_columns[0].name), ConsistencyLevel.SERIAL).column.value == first_columns[0].value
+            assert client.get(utf8encode('key1'), ColumnPath(column_family, column=first_columns[0].name), ConsistencyLevel.SERIAL).column.value == first_columns[0].value
 
             # cas first_columns -> second_columns should succeed
             assert cas(first_columns, second_columns, column_family).success
@@ -396,8 +425,8 @@ class TestMutations(TestThrift):
             cas_result = cas(first_columns, second_columns, column_family)
             assert not cas_result.success
 
-        updated_columns = [Column('c1', 'value101', 1),
-                           Column('c2', 'value102', 1)]
+        updated_columns = [Column(utf8encode('c1'), utf8encode('value101'), 1),
+                           Column(utf8encode('c2'), utf8encode('value102'), 1)]
 
         logger.debug("Testing CAS operations on dynamic cf")
         test_cas_operations(_SIMPLE_COLUMNS, updated_columns, 'Standard1')
@@ -410,9 +439,9 @@ class TestMutations(TestThrift):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1')
 
-        _expect_missing(lambda: client.get('key1', ColumnPath('Super1', 'sc1', _i64(1)), ConsistencyLevel.ONE))
+        _expect_missing(lambda: client.get(utf8encode('key1'), ColumnPath('Super1', utf8encode('sc1'), _i64(1)), ConsistencyLevel.ONE))
         _insert_super()
-        _expect_missing(lambda: client.get('key1', ColumnPath('Super1', 'sc1', _i64(1)), ConsistencyLevel.ONE))
+        _expect_missing(lambda: client.get(utf8encode('key1'), ColumnPath('Super1', utf8encode('sc1'), _i64(1)), ConsistencyLevel.ONE))
 
     def test_count(self):
         _set_keyspace('Keyspace1')
@@ -420,19 +449,19 @@ class TestMutations(TestThrift):
 
         _insert_simple()
         _insert_super()
-        p = SlicePredicate(slice_range=SliceRange('', '', False, 1000))
-        assert client.get_count('key1', ColumnParent('Standard2'), p, ConsistencyLevel.ONE) == 0
-        assert client.get_count('key1', ColumnParent('Standard1'), p, ConsistencyLevel.ONE) == 2
-        assert client.get_count('key1', ColumnParent('Super1', 'sc2'), p, ConsistencyLevel.ONE) == 2
-        assert client.get_count('key1', ColumnParent('Super1'), p, ConsistencyLevel.ONE) == 2
+        p = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 1000))
+        assert client.get_count(utf8encode('key1'), ColumnParent('Standard2'), p, ConsistencyLevel.ONE) == 0
+        assert client.get_count(utf8encode('key1'), ColumnParent('Standard1'), p, ConsistencyLevel.ONE) == 2
+        assert client.get_count(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')), p, ConsistencyLevel.ONE) == 2
+        assert client.get_count(utf8encode('key1'), ColumnParent('Super1'), p, ConsistencyLevel.ONE) == 2
 
         # Let's make that a little more interesting
-        client.insert('key1', ColumnParent('Standard1'), Column('c3', 'value3', 0), ConsistencyLevel.ONE)
-        client.insert('key1', ColumnParent('Standard1'), Column('c4', 'value4', 0), ConsistencyLevel.ONE)
-        client.insert('key1', ColumnParent('Standard1'), Column('c5', 'value5', 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c3'), utf8encode('value3'), 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c4'), utf8encode('value4'), 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c5'), utf8encode('value5'), 0), ConsistencyLevel.ONE)
 
-        p = SlicePredicate(slice_range=SliceRange('c2', 'c4', False, 1000))
-        assert client.get_count('key1', ColumnParent('Standard1'), p, ConsistencyLevel.ONE) == 3
+        p = SlicePredicate(slice_range=SliceRange(utf8encode('c2'), utf8encode('c4'), False, 1000))
+        assert client.get_count(utf8encode('key1'), ColumnParent('Standard1'), p, ConsistencyLevel.ONE) == 3
 
     def test_count_paging(self):
         _set_keyspace('Keyspace1')
@@ -443,16 +472,16 @@ class TestMutations(TestThrift):
         # Exercise paging
         column_parent = ColumnParent('Standard1')
         # Paging for small columns starts at 1024 columns
-        columns_to_insert = [Column('c%d' % (i,), 'value%d' % (i,), 0) for i in range(3, 1026)]
+        columns_to_insert = [Column(utf8encode('c%d' % (i,)), utf8encode('value%d' % (i,)), 0) for i in range(3, 1026)]
         cfmap = {'Standard1': [Mutation(ColumnOrSuperColumn(c)) for c in columns_to_insert]}
-        client.batch_mutate({'key1': cfmap}, ConsistencyLevel.ONE)
+        client.batch_mutate({utf8encode('key1') : cfmap}, ConsistencyLevel.ONE)
 
-        p = SlicePredicate(slice_range=SliceRange('', '', False, 2000))
-        assert client.get_count('key1', column_parent, p, ConsistencyLevel.ONE) == 1025
+        p = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 2000))
+        assert client.get_count(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE) == 1025
 
         # Ensure that the count limit isn't clobbered
-        p = SlicePredicate(slice_range=SliceRange('', '', False, 10))
-        assert client.get_count('key1', ColumnParent('Standard1'), p, ConsistencyLevel.ONE) == 10
+        p = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 10))
+        assert client.get_count(utf8encode('key1'), ColumnParent('Standard1'), p, ConsistencyLevel.ONE) == 10
 
     # test get_count() to work correctly with 'count' settings around page size (CASSANDRA-4833)
     def test_count_around_page_size(self):
@@ -460,14 +489,14 @@ class TestMutations(TestThrift):
         self.truncate_all('Standard1')
 
         def slice_predicate(count):
-            return SlicePredicate(slice_range=SliceRange('', '', False, count))
+            return SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, count))
 
-        key = 'key1'
+        key = utf8encode('key1')
         parent = ColumnParent('Standard1')
         cl = ConsistencyLevel.ONE
 
         for i in range(0, 3050):
-            client.insert(key, parent, Column(str(i), '', 0), cl)
+            client.insert(key, parent, Column(utf8encode(str(i)), utf8encode(''), 0), cl)
 
         # same as page size
         assert client.get_count(key, parent, slice_predicate(1024), cl) == 1024
@@ -496,22 +525,22 @@ class TestMutations(TestThrift):
         self.truncate_all('Super1')
 
         _insert_super()
-        result = client.get('key1', ColumnPath('Super1', 'sc2'), ConsistencyLevel.ONE).super_column
+        result = client.get(utf8encode('key1'), ColumnPath('Super1', utf8encode('sc2')), ConsistencyLevel.ONE).super_column
         assert result == _SUPER_COLUMNS[1], result
 
     def test_super_subcolumn_limit(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1')
         _insert_super()
-        p = SlicePredicate(slice_range=SliceRange('', '', False, 1))
-        column_parent = ColumnParent('Super1', 'sc2')
+        p = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 1))
+        column_parent = ColumnParent('Super1', utf8encode('sc2'))
         slice = [result.column
-                 for result in client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE)]
-        assert slice == [Column(_i64(5), 'value5', 0)], slice
-        p = SlicePredicate(slice_range=SliceRange('', '', True, 1))
+                 for result in client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE)]
+        assert slice == [Column(_i64(5), utf8encode('value5'), 0)], slice
+        p = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), True, 1))
         slice = [result.column
-                 for result in client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE)]
-        assert slice == [Column(_i64(6), 'value6', 0)], slice
+                 for result in client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE)]
+        assert slice == [Column(_i64(6), utf8encode('value6'), 0)], slice
 
     def test_long_order(self):
         _set_keyspace('Keyspace1')
@@ -525,9 +554,9 @@ class TestMutations(TestThrift):
         L = []
         for i in long_xrange(0, 104294967296, 429496729):
             name = _i64(i)
-            client.insert('key1', ColumnParent('StandardLong1'), Column(name, 'v', 0), ConsistencyLevel.ONE)
+            client.insert(utf8encode('key1'), ColumnParent('StandardLong1'), Column(name, utf8encode('v'), 0), ConsistencyLevel.ONE)
             L.append(name)
-        slice = [result.column.name for result in _big_slice('key1', ColumnParent('StandardLong1'))]
+        slice = [result.column.name for result in _big_slice(utf8encode('key1'), ColumnParent('StandardLong1'))]
         assert slice == L, slice
 
     def test_integer_order(self):
@@ -542,9 +571,9 @@ class TestMutations(TestThrift):
         L = []
         for i in long_xrange(104294967296, 0, 429496729):
             name = _i64(i)
-            client.insert('key1', ColumnParent('StandardInteger1'), Column(name, 'v', 0), ConsistencyLevel.ONE)
+            client.insert(utf8encode('key1'), ColumnParent('StandardInteger1'), Column(name, utf8encode('v'), 0), ConsistencyLevel.ONE)
             L.append(name)
-        slice = [result.column.name for result in _big_slice('key1', ColumnParent('StandardInteger1'))]
+        slice = [result.column.name for result in _big_slice(utf8encode('key1'), ColumnParent('StandardInteger1'))]
         L.sort()
         assert slice == L, slice
 
@@ -558,79 +587,79 @@ class TestMutations(TestThrift):
         # 100 isn't enough to fail reliably if the comparator is borked
         for i in range(500):
             L.append(uuid.uuid1())
-            client.insert('key1', ColumnParent('Super4', 'sc1'), Column(L[-1].bytes, 'value%s' % i, i), ConsistencyLevel.ONE)
-        slice = _big_slice('key1', ColumnParent('Super4', 'sc1'))
+            client.insert(utf8encode('key1'), ColumnParent('Super4', utf8encode('sc1')), Column(L[-1].bytes, utf8encode('value%s' % i), i), ConsistencyLevel.ONE)
+        slice = _big_slice(utf8encode('key1'), ColumnParent('Super4', utf8encode('sc1')))
         assert len(slice) == 500, len(slice)
         for i in range(500):
             u = slice[i].column
-            assert u.value == 'value%s' % i
+            assert u.value == utf8encode('value%s' % i)
             assert u.name == L[i].bytes
 
-        p = SlicePredicate(slice_range=SliceRange('', '', True, 1))
-        column_parent = ColumnParent('Super4', 'sc1')
+        p = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), True, 1))
+        column_parent = ColumnParent('Super4', utf8encode('sc1'))
         slice = [result.column
-                 for result in client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE)]
-        assert slice == [Column(L[-1].bytes, 'value499', 499)], slice
+                 for result in client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE)]
+        assert slice == [Column(L[-1].bytes, utf8encode('value499'), 499)], slice
 
-        p = SlicePredicate(slice_range=SliceRange('', L[2].bytes, False, 1000))
-        column_parent = ColumnParent('Super4', 'sc1')
+        p = SlicePredicate(slice_range=SliceRange(utf8encode(''), L[2].bytes, False, 1000))
+        column_parent = ColumnParent('Super4', utf8encode('sc1'))
         slice = [result.column
-                 for result in client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE)]
-        assert slice == [Column(L[0].bytes, 'value0', 0),
-                         Column(L[1].bytes, 'value1', 1),
-                         Column(L[2].bytes, 'value2', 2)], slice
+                 for result in client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE)]
+        assert slice == [Column(L[0].bytes, utf8encode('value0'), 0),
+                         Column(L[1].bytes, utf8encode('value1'), 1),
+                         Column(L[2].bytes, utf8encode('value2'), 2)], slice
 
-        p = SlicePredicate(slice_range=SliceRange(L[2].bytes, '', True, 1000))
-        column_parent = ColumnParent('Super4', 'sc1')
+        p = SlicePredicate(slice_range=SliceRange(L[2].bytes, utf8encode(''), True, 1000))
+        column_parent = ColumnParent('Super4', utf8encode('sc1'))
         slice = [result.column
-                 for result in client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE)]
-        assert slice == [Column(L[2].bytes, 'value2', 2),
-                         Column(L[1].bytes, 'value1', 1),
-                         Column(L[0].bytes, 'value0', 0)], slice
+                 for result in client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE)]
+        assert slice == [Column(L[2].bytes, utf8encode('value2'), 2),
+                         Column(L[1].bytes, utf8encode('value1'), 1),
+                         Column(L[0].bytes, utf8encode('value0'), 0)], slice
 
-        p = SlicePredicate(slice_range=SliceRange(L[2].bytes, '', False, 1))
-        column_parent = ColumnParent('Super4', 'sc1')
+        p = SlicePredicate(slice_range=SliceRange(L[2].bytes, utf8encode(''), False, 1))
+        column_parent = ColumnParent('Super4', utf8encode('sc1'))
         slice = [result.column
-                 for result in client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE)]
-        assert slice == [Column(L[2].bytes, 'value2', 2)], slice
+                 for result in client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE)]
+        assert slice == [Column(L[2].bytes, utf8encode('value2'), 2)], slice
 
     def test_long_remove(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('StandardLong1')
 
         column_parent = ColumnParent('StandardLong1')
-        sp = SlicePredicate(slice_range=SliceRange('', '', False, 1))
+        sp = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 1))
         for i in range(10):
             parent = ColumnParent('StandardLong1')
 
-            client.insert('key1', parent, Column(_i64(i), 'value1', 10 * i), ConsistencyLevel.ONE)
-            client.remove('key1', ColumnPath('StandardLong1'), 10 * i + 1, ConsistencyLevel.ONE)
-            slice = client.get_slice('key1', column_parent, sp, ConsistencyLevel.ONE)
+            client.insert(utf8encode('key1'), parent, Column(_i64(i), utf8encode('value1'), 10 * i), ConsistencyLevel.ONE)
+            client.remove(utf8encode('key1'), ColumnPath('StandardLong1'), 10 * i + 1, ConsistencyLevel.ONE)
+            slice = client.get_slice(utf8encode('key1'), column_parent, sp, ConsistencyLevel.ONE)
             assert slice == [], slice
             # resurrect
-            client.insert('key1', parent, Column(_i64(i), 'value2', 10 * i + 2), ConsistencyLevel.ONE)
+            client.insert(utf8encode('key1'), parent, Column(_i64(i), utf8encode('value2'), 10 * i + 2), ConsistencyLevel.ONE)
             slice = [result.column
-                     for result in client.get_slice('key1', column_parent, sp, ConsistencyLevel.ONE)]
-            assert slice == [Column(_i64(i), 'value2', 10 * i + 2)], (slice, i)
+                     for result in client.get_slice(utf8encode('key1'), column_parent, sp, ConsistencyLevel.ONE)]
+            assert slice == [Column(_i64(i), utf8encode('value2'), 10 * i + 2)], (slice, i)
 
     def test_integer_remove(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('StandardInteger1')
 
         column_parent = ColumnParent('StandardInteger1')
-        sp = SlicePredicate(slice_range=SliceRange('', '', False, 1))
+        sp = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 1))
         for i in range(10):
             parent = ColumnParent('StandardInteger1')
 
-            client.insert('key1', parent, Column(_i64(i), 'value1', 10 * i), ConsistencyLevel.ONE)
-            client.remove('key1', ColumnPath('StandardInteger1'), 10 * i + 1, ConsistencyLevel.ONE)
-            slice = client.get_slice('key1', column_parent, sp, ConsistencyLevel.ONE)
+            client.insert(utf8encode('key1'), parent, Column(_i64(i), utf8encode('value1'), 10 * i), ConsistencyLevel.ONE)
+            client.remove(utf8encode('key1'), ColumnPath('StandardInteger1'), 10 * i + 1, ConsistencyLevel.ONE)
+            slice = client.get_slice(utf8encode('key1'), column_parent, sp, ConsistencyLevel.ONE)
             assert slice == [], slice
             # resurrect
-            client.insert('key1', parent, Column(_i64(i), 'value2', 10 * i + 2), ConsistencyLevel.ONE)
+            client.insert(utf8encode('key1'), parent, Column(_i64(i), utf8encode('value2'), 10 * i + 2), ConsistencyLevel.ONE)
             slice = [result.column
-                     for result in client.get_slice('key1', column_parent, sp, ConsistencyLevel.ONE)]
-            assert slice == [Column(_i64(i), 'value2', 10 * i + 2)], (slice, i)
+                     for result in client.get_slice(utf8encode('key1'), column_parent, sp, ConsistencyLevel.ONE)]
+            assert slice == [Column(_i64(i), utf8encode('value2'), 10 * i + 2)], (slice, i)
 
     def test_batch_insert(self):
         _set_keyspace('Keyspace1')
@@ -643,7 +672,7 @@ class TestMutations(TestThrift):
         self.truncate_all('Standard1', 'Standard2')
 
         column_families = ['Standard1', 'Standard2']
-        keys = ['key_%d' % i for i in range(27, 32)]
+        keys = [utf8encode('key_%d' % i) for i in range(27, 32)]
         mutations = [Mutation(ColumnOrSuperColumn(c)) for c in _SIMPLE_COLUMNS]
         mutation_map = dict((column_family, mutations) for column_family in column_families)
         keyed_mutations = dict((key, mutation_map) for key in keys)
@@ -652,14 +681,14 @@ class TestMutations(TestThrift):
 
         for column_family in column_families:
             for key in keys:
-                _assert_column(column_family, key, 'c1', 'value1')
+                _assert_column(column_family, key, utf8encode('c1'), utf8encode('value1'))
 
     def test_batch_mutate_remove_standard_columns(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Standard1', 'Standard2')
 
         column_families = ['Standard1', 'Standard2']
-        keys = ['key_%d' % i for i in range(11, 21)]
+        keys = [utf8encode('key_%d' % i) for i in range(11, 21)]
         _insert_multi(keys)
 
         mutations = [Mutation(deletion=Deletion(20, predicate=SlicePredicate(column_names=[c.name]))) for c in _SIMPLE_COLUMNS]
@@ -679,7 +708,7 @@ class TestMutations(TestThrift):
         self.truncate_all('Standard1', 'Standard2')
 
         column_families = ['Standard1', 'Standard2']
-        keys = ['key_%d' % i for i in range(11, 21)]
+        keys = [utf8encode('key_%d' % i) for i in range(11, 21)]
         _insert_multi(keys)
 
         mutations = [Mutation(deletion=Deletion(20))]
@@ -699,7 +728,7 @@ class TestMutations(TestThrift):
         self.truncate_all('Super1', 'Super2')
 
         column_families = ['Super1', 'Super2']
-        keys = ['key_%d' % i for i in range(11, 21)]
+        keys = [utf8encode('key_%d' % i) for i in range(11, 21)]
         _insert_super()
 
         mutations = []
@@ -724,7 +753,7 @@ class TestMutations(TestThrift):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1')
 
-        keys = ['key_%d' % i for i in range(17, 21)]
+        keys = [utf8encode('key_%d' % i) for i in range(17, 21)]
 
         for key in keys:
             _insert_super(key)
@@ -755,7 +784,7 @@ class TestMutations(TestThrift):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1')
 
-        keys = ['key_%d' % i for i in range(17, 21)]
+        keys = [utf8encode('key_%d' % i) for i in range(17, 21)]
 
         for key in keys:
             _insert_super(key)
@@ -784,100 +813,101 @@ class TestMutations(TestThrift):
         _set_keyspace('Keyspace1')
         self.truncate_all('Standard1')
 
-        columns = [Column('c1', 'value1', 0),
-                   Column('c2', 'value2', 0),
-                   Column('c3', 'value3', 0),
-                   Column('c4', 'value4', 0),
-                   Column('c5', 'value5', 0)]
+        columns = [Column(utf8encode('c1'), utf8encode('value1'), 0),
+                   Column(utf8encode('c2'), utf8encode('value2'), 0),
+                   Column(utf8encode('c3'), utf8encode('value3'), 0),
+                   Column(utf8encode('c4'), utf8encode('value4'), 0),
+                   Column(utf8encode('c5'), utf8encode('value5'), 0)]
 
         for column in columns:
-            client.insert('key', ColumnParent('Standard1'), column, ConsistencyLevel.ONE)
+            client.insert(utf8encode('key'), ColumnParent('Standard1'), column, ConsistencyLevel.ONE)
 
-        d = Deletion(1, predicate=SlicePredicate(slice_range=SliceRange(start='c2', finish='c4')))
-        client.batch_mutate({'key': {'Standard1': [Mutation(deletion=d)]}}, ConsistencyLevel.ONE)
+        d = Deletion(1, predicate=SlicePredicate(slice_range=SliceRange(start=utf8encode('c2'), finish=utf8encode('c4'))))
+        client.batch_mutate({utf8encode('key'): {'Standard1': [Mutation(deletion=d)]}}, ConsistencyLevel.ONE)
 
-        _assert_columnpath_exists('key', ColumnPath('Standard1', column='c1'))
-        _assert_no_columnpath('key', ColumnPath('Standard1', column='c2'))
-        _assert_no_columnpath('key', ColumnPath('Standard1', column='c3'))
-        _assert_no_columnpath('key', ColumnPath('Standard1', column='c4'))
-        _assert_columnpath_exists('key', ColumnPath('Standard1', column='c5'))
+        _assert_columnpath_exists(utf8encode('key'), ColumnPath('Standard1', column=utf8encode('c1')))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Standard1', column=utf8encode('c2')))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Standard1', column=utf8encode('c3')))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Standard1', column=utf8encode('c4')))
+        _assert_columnpath_exists(utf8encode('key'), ColumnPath('Standard1', column=utf8encode('c5')))
 
     # known failure: see CASSANDRA-10046
     def test_batch_mutate_remove_slice_of_entire_supercolumns(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1')
 
-        columns = [SuperColumn(name='sc1', columns=[Column(_i64(1), 'value1', 0)]),
-                   SuperColumn(name='sc2',
-                               columns=[Column(_i64(2), 'value2', 0), Column(_i64(3), 'value3', 0)]),
-                   SuperColumn(name='sc3', columns=[Column(_i64(4), 'value4', 0)]),
-                   SuperColumn(name='sc4',
-                               columns=[Column(_i64(5), 'value5', 0), Column(_i64(6), 'value6', 0)]),
-                   SuperColumn(name='sc5', columns=[Column(_i64(7), 'value7', 0)])]
+        columns = [SuperColumn(name=utf8encode('sc1'), columns=[Column(_i64(1), utf8encode('value1'), 0)]),
+                   SuperColumn(name=utf8encode('sc2'),
+                               columns=[Column(_i64(2), utf8encode('value2') , 0), Column(_i64(3), utf8encode('value3') , 0)]),
+                   SuperColumn(name=utf8encode('sc3'), columns=[Column(_i64(4), utf8encode('value4'), 0)]),
+                   SuperColumn(name=utf8encode('sc4'),
+                               columns=[Column(_i64(5), utf8encode('value5') , 0), Column(_i64(6), utf8encode('value6') , 0)]),
+                   SuperColumn(name=utf8encode('sc5'), columns=[Column(_i64(7), utf8encode('value7'), 0)])]
 
         for column in columns:
             for subcolumn in column.columns:
-                client.insert('key', ColumnParent('Super1', column.name), subcolumn, ConsistencyLevel.ONE)
+                client.insert(utf8encode('key'), ColumnParent('Super1', column.name), subcolumn, ConsistencyLevel.ONE)
 
-        d = Deletion(1, predicate=SlicePredicate(slice_range=SliceRange(start='sc2', finish='sc4')))
-        client.batch_mutate({'key': {'Super1': [Mutation(deletion=d)]}}, ConsistencyLevel.ONE)
+        d = Deletion(1, predicate=SlicePredicate(slice_range=SliceRange(start=utf8encode('sc2') , finish=utf8encode('sc4') )))
+        client.batch_mutate({utf8encode('key'): {'Super1': [Mutation(deletion=d)]}}, ConsistencyLevel.ONE)
 
-        _assert_columnpath_exists('key', ColumnPath('Super1', super_column='sc1', column=_i64(1)))
-        _assert_no_columnpath('key', ColumnPath('Super1', super_column='sc2', column=_i64(2)))
-        _assert_no_columnpath('key', ColumnPath('Super1', super_column='sc2', column=_i64(3)))
-        _assert_no_columnpath('key', ColumnPath('Super1', super_column='sc3', column=_i64(4)))
-        _assert_no_columnpath('key', ColumnPath('Super1', super_column='sc4', column=_i64(5)))
-        _assert_no_columnpath('key', ColumnPath('Super1', super_column='sc4', column=_i64(6)))
-        _assert_columnpath_exists('key', ColumnPath('Super1', super_column='sc5', column=_i64(7)))
+        _assert_columnpath_exists(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc1'), column=_i64(1)))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc2'), column=_i64(2)))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc2'), column=_i64(3)))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc3'), column=_i64(4)))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc4'), column=_i64(5)))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc4'), column=_i64(6)))
+        _assert_columnpath_exists(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc5'), column=_i64(7)))
 
     @since('1.0', '2.2')
+    @pytest.mark.skip(reason="Runs but fails and looks like it actually should fail since 8099?")
     def test_batch_mutate_remove_slice_part_of_supercolumns(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1')
 
-        columns = [Column(_i64(1), 'value1', 0),
-                   Column(_i64(2), 'value2', 0),
-                   Column(_i64(3), 'value3', 0),
-                   Column(_i64(4), 'value4', 0),
-                   Column(_i64(5), 'value5', 0)]
+        columns = [Column(_i64(1), utf8encode('value1'), 0),
+                   Column(_i64(2), utf8encode('value2'), 0),
+                   Column(_i64(3), utf8encode('value3'), 0),
+                   Column(_i64(4), utf8encode('value4'), 0),
+                   Column(_i64(5), utf8encode('value5'), 0)]
 
         for column in columns:
-            client.insert('key', ColumnParent('Super1', 'sc1'), column, ConsistencyLevel.ONE)
+            client.insert(utf8encode('key'), ColumnParent('Super1', utf8encode('sc1')), column, ConsistencyLevel.ONE)
 
         r = SliceRange(start=_i64(2), finish=_i64(4))
-        d = Deletion(1, super_column='sc1', predicate=SlicePredicate(slice_range=r))
-        client.batch_mutate({'key': {'Super1': [Mutation(deletion=d)]}}, ConsistencyLevel.ONE)
+        d = Deletion(1, super_column=utf8encode('sc1') , predicate=SlicePredicate(slice_range=r))
+        client.batch_mutate({utf8encode('key'): {'Super1' : [Mutation(deletion=d)]}}, ConsistencyLevel.ONE)
 
-        _assert_columnpath_exists('key', ColumnPath('Super1', super_column='sc1', column=_i64(1)))
-        _assert_no_columnpath('key', ColumnPath('Super1', super_column='sc1', column=_i64(2)))
-        _assert_no_columnpath('key', ColumnPath('Super1', super_column='sc1', column=_i64(3)))
-        _assert_no_columnpath('key', ColumnPath('Super1', super_column='sc1', column=_i64(4)))
-        _assert_columnpath_exists('key', ColumnPath('Super1', super_column='sc1', column=_i64(5)))
+        _assert_columnpath_exists(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc1'), column=_i64(1)))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc1'), column=_i64(2)))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc1'), column=_i64(3)))
+        _assert_no_columnpath(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc1'), column=_i64(4)))
+        _assert_columnpath_exists(utf8encode('key'), ColumnPath('Super1', super_column=utf8encode('sc1'), column=_i64(5)))
 
     def test_batch_mutate_insertions_and_deletions(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1', 'Super2')
 
-        first_insert = SuperColumn("sc1",
-                                   columns=[Column(_i64(20), 'value20', 3),
-                                            Column(_i64(21), 'value21', 3)])
-        second_insert = SuperColumn("sc1",
-                                    columns=[Column(_i64(20), 'value20', 3),
-                                             Column(_i64(21), 'value21', 3)])
-        first_deletion = {'super_column': "sc1",
+        first_insert = SuperColumn(utf8encode("sc1"),
+                                   columns=[Column(_i64(20), utf8encode('value20'), 3),
+                                            Column(_i64(21), utf8encode('value21'), 3)])
+        second_insert = SuperColumn(utf8encode("sc1"),
+                                    columns=[Column(_i64(20), utf8encode('value20'), 3),
+                                             Column(_i64(21), utf8encode('value21'), 3)])
+        first_deletion = {'super_column': utf8encode("sc1"),
                           'predicate': SlicePredicate(column_names=[_i64(22), _i64(23)])}
-        second_deletion = {'super_column': "sc2",
+        second_deletion = {'super_column': utf8encode("sc2"),
                            'predicate': SlicePredicate(column_names=[_i64(22), _i64(23)])}
 
-        keys = ['key_30', 'key_31']
+        keys = [utf8encode('key_30'), utf8encode('key_31')]
         for key in keys:
-            sc = SuperColumn('sc1', [Column(_i64(22), 'value22', 0),
-                                     Column(_i64(23), 'value23', 0)])
+            sc = SuperColumn(utf8encode('sc1'), [Column(_i64(22), utf8encode('value22'), 0),
+                                     Column(_i64(23), utf8encode('value23'), 0)])
             cfmap = {'Super1': [Mutation(ColumnOrSuperColumn(super_column=sc))]}
             client.batch_mutate({key: cfmap}, ConsistencyLevel.ONE)
 
-            sc2 = SuperColumn('sc2', [Column(_i64(22), 'value22', 0),
-                                      Column(_i64(23), 'value23', 0)])
+            sc2 = SuperColumn(utf8encode('sc2'), [Column(_i64(22), utf8encode('value22'), 0),
+                                      Column(_i64(23), utf8encode('value23'), 0)])
             cfmap2 = {'Super2': [Mutation(ColumnOrSuperColumn(super_column=sc2))]}
             client.batch_mutate({key: cfmap2}, ConsistencyLevel.ONE)
 
@@ -894,18 +924,18 @@ class TestMutations(TestThrift):
 
         for key in keys:
             for c in [_i64(22), _i64(23)]:
-                _assert_no_columnpath(key, ColumnPath('Super1', super_column='sc1', column=c))
-                _assert_no_columnpath(key, ColumnPath('Super2', super_column='sc2', column=c))
+                _assert_no_columnpath(key, ColumnPath('Super1', super_column=utf8encode('sc1'), column=c))
+                _assert_no_columnpath(key, ColumnPath('Super2', super_column=utf8encode('sc2'), column=c))
 
             for c in [_i64(20), _i64(21)]:
-                _assert_columnpath_exists(key, ColumnPath('Super1', super_column='sc1', column=c))
-                _assert_columnpath_exists(key, ColumnPath('Super2', super_column='sc1', column=c))
+                _assert_columnpath_exists(key, ColumnPath('Super1', super_column=utf8encode('sc1'), column=c))
+                _assert_columnpath_exists(key, ColumnPath('Super2', super_column=utf8encode('sc1'), column=c))
 
     def test_bad_system_calls(self):
         def duplicate_index_names():
             _set_keyspace('Keyspace1')
-            cd1 = ColumnDef('foo', 'BytesType', IndexType.KEYS, 'i')
-            cd2 = ColumnDef('bar', 'BytesType', IndexType.KEYS, 'i')
+            cd1 = ColumnDef(utf8encode('foo'), 'BytesType', IndexType.KEYS, 'i')
+            cd2 = ColumnDef(utf8encode('bar'), 'BytesType', IndexType.KEYS, 'i')
             cf = CfDef('Keyspace1', 'BadCF', column_metadata=[cd1, cd2])
             client.system_add_column_family(cf)
         _expect_exception(duplicate_index_names, InvalidRequestException)
@@ -914,33 +944,33 @@ class TestMutations(TestThrift):
         # mutate_does_not_accept_cosc_and_deletion_in_same_mutation
         def too_full():
             _set_keyspace('Keyspace1')
-            col = ColumnOrSuperColumn(column=Column("foo", 'bar', 0))
-            dele = Deletion(2, predicate=SlicePredicate(column_names=['baz']))
-            client.batch_mutate({'key_34': {'Standard1': [Mutation(col, dele)]}},
+            col = ColumnOrSuperColumn(column=Column(utf8encode("foo"), utf8encode('bar'), 0))
+            dele = Deletion(2, predicate=SlicePredicate(column_names=[utf8encode('baz')]))
+            client.batch_mutate({utf8encode('key_34'): {'Standard1': [Mutation(col, dele)]}},
                                 ConsistencyLevel.ONE)
         _expect_exception(too_full, InvalidRequestException)
 
         # test_batch_mutate_does_not_accept_cosc_on_undefined_cf:
         def bad_cf():
             _set_keyspace('Keyspace1')
-            col = ColumnOrSuperColumn(column=Column("foo", 'bar', 0))
-            client.batch_mutate({'key_36': {'Undefined': [Mutation(col)]}},
+            col = ColumnOrSuperColumn(column=Column(utf8encode("foo"), utf8encode('bar'), 0))
+            client.batch_mutate({utf8encode('key_36'): {'Undefined': [Mutation(col)]}},
                                 ConsistencyLevel.ONE)
         _expect_exception(bad_cf, InvalidRequestException)
 
         # test_batch_mutate_does_not_accept_deletion_on_undefined_cf
         def bad_cf_2():
             _set_keyspace('Keyspace1')
-            d = Deletion(2, predicate=SlicePredicate(column_names=['baz']))
-            client.batch_mutate({'key_37': {'Undefined': [Mutation(deletion=d)]}},
+            d = Deletion(2, predicate=SlicePredicate(column_names=[utf8encode('baz')]))
+            client.batch_mutate({utf8encode('key_37'): {'Undefined': [Mutation(deletion=d)]}},
                                 ConsistencyLevel.ONE)
         _expect_exception(bad_cf_2, InvalidRequestException)
 
         # a column value that does not match the declared validator
         def send_string_instead_of_long():
             _set_keyspace('Keyspace1')
-            col = ColumnOrSuperColumn(column=Column('birthdate', 'bar', 0))
-            client.batch_mutate({'key_38': {'Indexed1': [Mutation(col)]}},
+            col = ColumnOrSuperColumn(column=Column(utf8encode('birthdate'), utf8encode('bar'), 0))
+            client.batch_mutate({utf8encode('key_38'): {'Indexed1': [Mutation(col)]}},
                                 ConsistencyLevel.ONE)
         _expect_exception(send_string_instead_of_long, InvalidRequestException)
 
@@ -948,16 +978,16 @@ class TestMutations(TestThrift):
         _set_keyspace('Keyspace1')
         self.truncate_all('Standard1')
 
-        _expect_exception(lambda: client.insert('key1', ColumnParent('Standard1'), Column('', 'value', 0), ConsistencyLevel.ONE), InvalidRequestException)
-        client.insert('key1', ColumnParent('Standard1'), Column('x' * 1, 'value', 0), ConsistencyLevel.ONE)
-        client.insert('key1', ColumnParent('Standard1'), Column('x' * 127, 'value', 0), ConsistencyLevel.ONE)
-        client.insert('key1', ColumnParent('Standard1'), Column('x' * 128, 'value', 0), ConsistencyLevel.ONE)
-        client.insert('key1', ColumnParent('Standard1'), Column('x' * 129, 'value', 0), ConsistencyLevel.ONE)
-        client.insert('key1', ColumnParent('Standard1'), Column('x' * 255, 'value', 0), ConsistencyLevel.ONE)
-        client.insert('key1', ColumnParent('Standard1'), Column('x' * 256, 'value', 0), ConsistencyLevel.ONE)
-        client.insert('key1', ColumnParent('Standard1'), Column('x' * 257, 'value', 0), ConsistencyLevel.ONE)
-        client.insert('key1', ColumnParent('Standard1'), Column('x' * (2 ** 16 - 1), 'value', 0), ConsistencyLevel.ONE)
-        _expect_exception(lambda: client.insert('key1', ColumnParent('Standard1'), Column('x' * (2 ** 16), 'value', 0), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode(''), utf8encode('value'), 0), ConsistencyLevel.ONE), InvalidRequestException)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('x' * 1), utf8encode('value'), 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('x' * 127), utf8encode('value'), 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('x' * 128), utf8encode('value'), 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('x' * 129), utf8encode('value'), 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('x' * 255), utf8encode('value'), 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('x' * 256), utf8encode('value'), 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('x' * 257), utf8encode('value'), 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('x' * (2 ** 16 - 1)), utf8encode('value'), 0), ConsistencyLevel.ONE)
+        _expect_exception(lambda: client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('x' * (2 ** 16)), utf8encode('value'), 0), ConsistencyLevel.ONE), InvalidRequestException)
 
     def test_bad_calls(self):
         _set_keyspace('Keyspace1')
@@ -965,71 +995,71 @@ class TestMutations(TestThrift):
         # missing arguments
         _expect_exception(lambda: client.insert(None, None, None, None), TApplicationException)
         # supercolumn in a non-super CF
-        _expect_exception(lambda: client.insert('key1', ColumnParent('Standard1', 'x'), Column('y', 'value', 0), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.insert(utf8encode('key1'), ColumnParent('Standard1', utf8encode('x')), Column(utf8encode('y'), utf8encode('value'), 0), ConsistencyLevel.ONE), InvalidRequestException)
         # no supercolumn in a super CF
-        _expect_exception(lambda: client.insert('key1', ColumnParent('Super1'), Column('y', 'value', 0), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.insert(utf8encode('key1'), ColumnParent('Super1'), Column(utf8encode('y'), utf8encode('value'), 0), ConsistencyLevel.ONE), InvalidRequestException)
         # column but no supercolumn in remove
-        _expect_exception(lambda: client.remove('key1', ColumnPath('Super1', column='x'), 0, ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.remove(utf8encode('key1'), ColumnPath('Super1', column=utf8encode('x')), 0, ConsistencyLevel.ONE), InvalidRequestException)
         # super column in non-super CF
-        _expect_exception(lambda: client.remove('key1', ColumnPath('Standard1', 'y', 'x'), 0, ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.remove(utf8encode('key1'), ColumnPath('Standard1', utf8encode('y'), utf8encode('x')), 0, ConsistencyLevel.ONE), InvalidRequestException)
         # key too long
-        _expect_exception(lambda: client.get('x' * 2 ** 16, ColumnPath('Standard1', column='c1'), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.get(utf8encode('x' * 2 ** 16), ColumnPath('Standard1', column=utf8encode('c1')), ConsistencyLevel.ONE), InvalidRequestException)
         # empty key
-        _expect_exception(lambda: client.get('', ColumnPath('Standard1', column='c1'), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.get(utf8encode(''), ColumnPath('Standard1', column=utf8encode('c1')), ConsistencyLevel.ONE), InvalidRequestException)
         cfmap = {'Super1': [Mutation(ColumnOrSuperColumn(super_column=c)) for c in _SUPER_COLUMNS],
                  'Super2': [Mutation(ColumnOrSuperColumn(super_column=c)) for c in _SUPER_COLUMNS]}
-        _expect_exception(lambda: client.batch_mutate({'': cfmap}, ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.batch_mutate({utf8encode(''): cfmap}, ConsistencyLevel.ONE), InvalidRequestException)
         # empty column name
-        _expect_exception(lambda: client.get('key1', ColumnPath('Standard1', column=''), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.get(utf8encode('key1'), ColumnPath('Standard1', column=utf8encode('')), ConsistencyLevel.ONE), InvalidRequestException)
         # get doesn't specify column name
-        _expect_exception(lambda: client.get('key1', ColumnPath('Standard1'), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.get(utf8encode('key1'), ColumnPath('Standard1'), ConsistencyLevel.ONE), InvalidRequestException)
         # supercolumn in a non-super CF
-        _expect_exception(lambda: client.get('key1', ColumnPath('Standard1', 'x', 'y'), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.get(utf8encode('key1'), ColumnPath('Standard1', utf8encode('x'), utf8encode('y')), ConsistencyLevel.ONE), InvalidRequestException)
         # get doesn't specify supercolumn name
-        _expect_exception(lambda: client.get('key1', ColumnPath('Super1'), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.get(utf8encode('key1'), ColumnPath('Super1'), ConsistencyLevel.ONE), InvalidRequestException)
         # invalid CF
-        _expect_exception(lambda: get_range_slice(client, ColumnParent('S'), SlicePredicate(column_names=['', '']), '', '', 5, ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: get_range_slice(client, ColumnParent('S'), SlicePredicate(column_names=[utf8encode(''), utf8encode('')]), utf8encode(''), utf8encode(''), 5, ConsistencyLevel.ONE), InvalidRequestException)
         # 'x' is not a valid Long
-        _expect_exception(lambda: client.insert('key1', ColumnParent('Super1', 'sc1'), Column('x', 'value', 0), ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc1')), Column(utf8encode('x'), utf8encode('value'), 0), ConsistencyLevel.ONE), InvalidRequestException)
         # start is not a valid Long
-        p = SlicePredicate(slice_range=SliceRange('x', '', False, 1))
+        p = SlicePredicate(slice_range=SliceRange(utf8encode('x'), utf8encode(''), False, 1))
         column_parent = ColumnParent('StandardLong1')
-        _expect_exception(lambda: client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE),
+        _expect_exception(lambda: client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE),
                           InvalidRequestException)
         # start > finish
         p = SlicePredicate(slice_range=SliceRange(_i64(10), _i64(0), False, 1))
         column_parent = ColumnParent('StandardLong1')
-        _expect_exception(lambda: client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE),
+        _expect_exception(lambda: client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE),
                           InvalidRequestException)
         # start is not a valid Long, supercolumn version
-        p = SlicePredicate(slice_range=SliceRange('x', '', False, 1))
-        column_parent = ColumnParent('Super1', 'sc1')
-        _expect_exception(lambda: client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE),
+        p = SlicePredicate(slice_range=SliceRange(utf8encode('x'), utf8encode(''), False, 1))
+        column_parent = ColumnParent('Super1', utf8encode('sc1'))
+        _expect_exception(lambda: client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE),
                           InvalidRequestException)
         # start > finish, supercolumn version
         p = SlicePredicate(slice_range=SliceRange(_i64(10), _i64(0), False, 1))
-        column_parent = ColumnParent('Super1', 'sc1')
-        _expect_exception(lambda: client.get_slice('key1', column_parent, p, ConsistencyLevel.ONE),
+        column_parent = ColumnParent('Super1', utf8encode('sc1'))
+        _expect_exception(lambda: client.get_slice(utf8encode('key1'), column_parent, p, ConsistencyLevel.ONE),
                           InvalidRequestException)
         # start > finish, key version
-        _expect_exception(lambda: get_range_slice(client, ColumnParent('Standard1'), SlicePredicate(column_names=['']), 'z', 'a', 1, ConsistencyLevel.ONE), InvalidRequestException)
+        _expect_exception(lambda: get_range_slice(client, ColumnParent('Standard1'), SlicePredicate(column_names=[utf8encode('')]), utf8encode('z'), utf8encode('a'), 1, ConsistencyLevel.ONE), InvalidRequestException)
         # ttl must be greater or equals to zero
-        column = Column('cttl1', 'value1', 0, -1)
-        _expect_exception(lambda: client.insert('key1', ColumnParent('Standard1'), column, ConsistencyLevel.ONE),
+        column = Column(utf8encode('cttl1'), utf8encode('value1'), 0, -1)
+        _expect_exception(lambda: client.insert(utf8encode('key1'), ColumnParent('Standard1'), column, ConsistencyLevel.ONE),
                           InvalidRequestException)
         # don't allow super_column in Deletion for standard Columntest_expiration_with_default_ttl_and_zero_ttl
-        deletion = Deletion(1, 'supercolumn', None)
+        deletion = Deletion(1, utf8encode('supercolumn'), None)
         mutation = Mutation(deletion=deletion)
-        mutations = {'key': {'Standard1': [mutation]}}
+        mutations = {utf8encode('key'): {'Standard1': [mutation]}}
         _expect_exception(lambda: client.batch_mutate(mutations, ConsistencyLevel.QUORUM),
                           InvalidRequestException)
         # 'x' is not a valid long
-        deletion = Deletion(1, 'x', None)
+        deletion = Deletion(1, utf8encode('x'), None)
         mutation = Mutation(deletion=deletion)
-        mutations = {'key': {'Super3': [mutation]}}
+        mutations = {utf8encode('key'): {'Super3': [mutation]}}
         _expect_exception(lambda: client.batch_mutate(mutations, ConsistencyLevel.QUORUM), InvalidRequestException)
         # counters don't support ANY
-        _expect_exception(lambda: client.add('key1', ColumnParent('Counter1', 'x'), CounterColumn('y', 1), ConsistencyLevel.ANY), InvalidRequestException)
+        _expect_exception(lambda: client.add(utf8encode('key1'), ColumnParent('Counter1', utf8encode('x')), CounterColumn(utf8encode('y'), 1), ConsistencyLevel.ANY), InvalidRequestException)
 
     def test_batch_insert_super(self):
         _set_keyspace('Keyspace1')
@@ -1039,7 +1069,7 @@ class TestMutations(TestThrift):
                             for c in _SUPER_COLUMNS],
                  'Super2': [Mutation(ColumnOrSuperColumn(super_column=c))
                             for c in _SUPER_COLUMNS]}
-        client.batch_mutate({'key1': cfmap}, ConsistencyLevel.ONE)
+        client.batch_mutate({utf8encode('key1'): cfmap}, ConsistencyLevel.ONE)
         _verify_super('Super1')
         _verify_super('Super2')
 
@@ -1048,30 +1078,30 @@ class TestMutations(TestThrift):
         self.truncate_all('Standard1')
 
         _insert_simple()
-        client.remove('key1', ColumnPath('Standard1', column='c1'), 1, ConsistencyLevel.ONE)
-        _expect_missing(lambda: client.get('key1', ColumnPath('Standard1', column='c1'), ConsistencyLevel.ONE))
-        assert client.get('key1', ColumnPath('Standard1', column='c2'), ConsistencyLevel.ONE).column \
-            == Column('c2', 'value2', 0)
-        assert _big_slice('key1', ColumnParent('Standard1')) \
-            == [ColumnOrSuperColumn(column=Column('c2', 'value2', 0))]
+        client.remove(utf8encode('key1'), ColumnPath('Standard1', column=utf8encode('c1')), 1, ConsistencyLevel.ONE)
+        _expect_missing(lambda: client.get(utf8encode('key1'), ColumnPath('Standard1', column=utf8encode('c1')), ConsistencyLevel.ONE))
+        assert client.get(utf8encode('key1'), ColumnPath('Standard1', column=utf8encode('c2')), ConsistencyLevel.ONE).column \
+            == Column(utf8encode('c2'), utf8encode('value2'), 0)
+        assert _big_slice(utf8encode('key1'), ColumnParent('Standard1')) \
+            == [ColumnOrSuperColumn(column=Column(utf8encode('c2'), utf8encode('value2'), 0))]
 
         # New insert, make sure it shows up post-remove:
-        client.insert('key1', ColumnParent('Standard1'), Column('c3', 'value3', 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c3'), utf8encode('value3'), 0), ConsistencyLevel.ONE)
         columns = [result.column
-                   for result in _big_slice('key1', ColumnParent('Standard1'))]
-        assert columns == [Column('c2', 'value2', 0), Column('c3', 'value3', 0)], columns
+                   for result in _big_slice(utf8encode('key1'), ColumnParent('Standard1'))]
+        assert columns == [Column(utf8encode('c2'), utf8encode('value2'), 0), Column(utf8encode('c3'), utf8encode('value3'), 0)], columns
 
         # Test resurrection.  First, re-insert the value w/ older timestamp,
         # and make sure it stays removed
-        client.insert('key1', ColumnParent('Standard1'), Column('c1', 'value1', 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c1'), utf8encode('value1'), 0), ConsistencyLevel.ONE)
         columns = [result.column
-                   for result in _big_slice('key1', ColumnParent('Standard1'))]
-        assert columns == [Column('c2', 'value2', 0), Column('c3', 'value3', 0)], columns
+                   for result in _big_slice(utf8encode('key1'), ColumnParent('Standard1'))]
+        assert columns == [Column(utf8encode('c2'), utf8encode('value2'), 0), Column(utf8encode('c3'), utf8encode('value3'), 0)], columns
         # Next, w/ a newer timestamp; it should come back:
-        client.insert('key1', ColumnParent('Standard1'), Column('c1', 'value1', 2), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c1'), utf8encode('value1'), 2), ConsistencyLevel.ONE)
         columns = [result.column
-                   for result in _big_slice('key1', ColumnParent('Standard1'))]
-        assert columns == [Column('c1', 'value1', 2), Column('c2', 'value2', 0), Column('c3', 'value3', 0)], columns
+                   for result in _big_slice(utf8encode('key1'), ColumnParent('Standard1'))]
+        assert columns == [Column(utf8encode('c1'), utf8encode('value1'), 2), Column(utf8encode('c2'), utf8encode('value2'), 0), Column(utf8encode('c3'), utf8encode('value3'), 0)], columns
 
     def test_cf_remove(self):
         _set_keyspace('Keyspace1')
@@ -1081,36 +1111,36 @@ class TestMutations(TestThrift):
         _insert_super()
 
         # Remove the key1:Standard1 cf; verify super is unaffected
-        client.remove('key1', ColumnPath('Standard1'), 3, ConsistencyLevel.ONE)
-        assert _big_slice('key1', ColumnParent('Standard1')) == []
+        client.remove(utf8encode('key1'), ColumnPath('Standard1'), 3, ConsistencyLevel.ONE)
+        assert _big_slice(utf8encode('key1'), ColumnParent('Standard1')) == []
         _verify_super()
 
         # Test resurrection.  First, re-insert a value w/ older timestamp,
         # and make sure it stays removed:
-        client.insert('key1', ColumnParent('Standard1'), Column('c1', 'value1', 0), ConsistencyLevel.ONE)
-        assert _big_slice('key1', ColumnParent('Standard1')) == []
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c1'), utf8encode('value1'), 0), ConsistencyLevel.ONE)
+        assert _big_slice(utf8encode('key1'), ColumnParent('Standard1')) == []
         # Next, w/ a newer timestamp; it should come back:
-        client.insert('key1', ColumnParent('Standard1'), Column('c1', 'value1', 4), ConsistencyLevel.ONE)
-        result = _big_slice('key1', ColumnParent('Standard1'))
-        assert result == [ColumnOrSuperColumn(column=Column('c1', 'value1', 4))], result
+        client.insert(utf8encode('key1'), ColumnParent('Standard1'), Column(utf8encode('c1'), utf8encode('value1'), 4), ConsistencyLevel.ONE)
+        result = _big_slice(utf8encode('key1'), ColumnParent('Standard1'))
+        assert result == [ColumnOrSuperColumn(column=Column(utf8encode('c1'), utf8encode('value1'), 4))], result
 
         # check removing the entire super cf, too.
-        client.remove('key1', ColumnPath('Super1'), 3, ConsistencyLevel.ONE)
-        assert _big_slice('key1', ColumnParent('Super1')) == []
-        assert _big_slice('key1', ColumnParent('Super1', 'sc1')) == []
+        client.remove(utf8encode('key1'), ColumnPath('Super1'), 3, ConsistencyLevel.ONE)
+        assert _big_slice(utf8encode('key1'), ColumnParent('Super1')) == []
+        assert _big_slice(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc1'))) == []
 
     def test_super_cf_remove_and_range_slice(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1')
 
-        client.insert('key3', ColumnParent('Super1', 'sc1'), Column(_i64(1), 'v1', 0), ConsistencyLevel.ONE)
-        client.remove('key3', ColumnPath('Super1', 'sc1'), 5, ConsistencyLevel.ONE)
+        client.insert(utf8encode('key3'), ColumnParent('Super1', utf8encode('sc1')), Column(_i64(1), utf8encode('v1'), 0), ConsistencyLevel.ONE)
+        client.remove(utf8encode('key3'), ColumnPath('Super1', utf8encode('sc1')), 5, ConsistencyLevel.ONE)
 
         rows = {}
-        for row in get_range_slice(client, ColumnParent('Super1'), SlicePredicate(slice_range=SliceRange('', '', False, 1000)), '', '', 1000, ConsistencyLevel.ONE):
+        for row in get_range_slice(client, ColumnParent('Super1'), SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 1000)), utf8encode(''), utf8encode(''), 1000, ConsistencyLevel.ONE):
             scs = [cosc.super_column for cosc in row.columns]
             rows[row.key] = scs
-        assert rows == {'key3': []}, rows
+        assert rows == {utf8encode('key3'): []}, rows
 
     def test_super_cf_remove_column(self):
         _set_keyspace('Keyspace1')
@@ -1120,42 +1150,42 @@ class TestMutations(TestThrift):
         _insert_super()
 
         # Make sure remove clears out what it's supposed to, and _only_ that:
-        client.remove('key1', ColumnPath('Super1', 'sc2', _i64(5)), 5, ConsistencyLevel.ONE)
-        _expect_missing(lambda: client.get('key1', ColumnPath('Super1', 'sc2', _i64(5)), ConsistencyLevel.ONE))
-        super_columns = [result.super_column for result in _big_slice('key1', ColumnParent('Super1'))]
-        assert super_columns == [SuperColumn(name='sc1', columns=[Column(_i64(4), 'value4', 0)]),
-                                 SuperColumn(name='sc2', columns=[Column(_i64(6), 'value6', 0)])]
+        client.remove(utf8encode('key1'), ColumnPath('Super1', utf8encode('sc2'), _i64(5)), 5, ConsistencyLevel.ONE)
+        _expect_missing(lambda: client.get(utf8encode('key1'), ColumnPath('Super1', utf8encode('sc2'), _i64(5)), ConsistencyLevel.ONE))
+        super_columns = [result.super_column for result in _big_slice(utf8encode('key1'), ColumnParent('Super1'))]
+        assert super_columns == [SuperColumn(name=utf8encode('sc1'), columns=[Column(_i64(4), utf8encode('value4'), 0)]),
+                                 SuperColumn(name=utf8encode('sc2'), columns=[Column(_i64(6), utf8encode('value6'), 0)])]
         _verify_simple()
 
         # New insert, make sure it shows up post-remove:
-        client.insert('key1', ColumnParent('Super1', 'sc2'), Column(_i64(7), 'value7', 0), ConsistencyLevel.ONE)
-        super_columns_expected = [SuperColumn(name='sc1',
-                                              columns=[Column(_i64(4), 'value4', 0)]),
-                                  SuperColumn(name='sc2',
-                                              columns=[Column(_i64(6), 'value6', 0), Column(_i64(7), 'value7', 0)])]
+        client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')), Column(_i64(7), utf8encode('value7'), 0), ConsistencyLevel.ONE)
+        super_columns_expected = [SuperColumn(name=utf8encode('sc1'),
+                                              columns=[Column(_i64(4), utf8encode('value4'), 0)]),
+                                  SuperColumn(name=utf8encode('sc2'),
+                                              columns=[Column(_i64(6), utf8encode('value6'), 0), Column(_i64(7), utf8encode('value7'), 0)])]
 
-        super_columns = [result.super_column for result in _big_slice('key1', ColumnParent('Super1'))]
+        super_columns = [result.super_column for result in _big_slice(utf8encode('key1'), ColumnParent('Super1'))]
         assert super_columns == super_columns_expected, super_columns
 
         # Test resurrection.  First, re-insert the value w/ older timestamp,
         # and make sure it stays removed:
-        client.insert('key1', ColumnParent('Super1', 'sc2'), Column(_i64(5), 'value5', 0), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')), Column(_i64(5), utf8encode('value5'), 0), ConsistencyLevel.ONE)
 
-        super_columns = [result.super_column for result in _big_slice('key1', ColumnParent('Super1'))]
+        super_columns = [result.super_column for result in _big_slice(utf8encode('key1'), ColumnParent('Super1'))]
         assert super_columns == super_columns_expected, super_columns
 
         # Next, w/ a newer timestamp; it should come back
-        client.insert('key1', ColumnParent('Super1', 'sc2'), Column(_i64(5), 'value5', 6), ConsistencyLevel.ONE)
-        super_columns = [result.super_column for result in _big_slice('key1', ColumnParent('Super1'))]
-        super_columns_expected = [SuperColumn(name='sc1', columns=[Column(_i64(4), 'value4', 0)]),
-                                  SuperColumn(name='sc2', columns=[Column(_i64(5), 'value5', 6),
-                                                                   Column(_i64(6), 'value6', 0),
-                                                                   Column(_i64(7), 'value7', 0)])]
+        client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')), Column(_i64(5), utf8encode('value5'), 6), ConsistencyLevel.ONE)
+        super_columns = [result.super_column for result in _big_slice(utf8encode('key1'), ColumnParent('Super1'))]
+        super_columns_expected = [SuperColumn(name=utf8encode('sc1'), columns=[Column(_i64(4), utf8encode('value4'), 0)]),
+                                  SuperColumn(name=utf8encode('sc2'), columns=[Column(_i64(5), utf8encode('value5'), 6),
+                                                                   Column(_i64(6), utf8encode('value6'), 0),
+                                                                   Column(_i64(7), utf8encode('value7'), 0)])]
         assert super_columns == super_columns_expected, super_columns
 
         # shouldn't be able to specify a column w/o a super column for remove
-        cp = ColumnPath(column_family='Super1', column='sc2')
-        e = _expect_exception(lambda: client.remove('key1', cp, 5, ConsistencyLevel.ONE), InvalidRequestException)
+        cp = ColumnPath(column_family='Super1', column=utf8encode('sc2'))
+        e = _expect_exception(lambda: client.remove(utf8encode('key1'), cp, 5, ConsistencyLevel.ONE), InvalidRequestException)
         assert e.why.find("column cannot be specified without") >= 0
 
     def test_super_cf_remove_supercolumn(self):
@@ -1166,66 +1196,66 @@ class TestMutations(TestThrift):
         _insert_super()
 
         # Make sure remove clears out what it's supposed to, and _only_ that:
-        client.remove('key1', ColumnPath('Super1', 'sc2'), 5, ConsistencyLevel.ONE)
-        _expect_missing(lambda: client.get('key1', ColumnPath('Super1', 'sc2', _i64(5)), ConsistencyLevel.ONE))
-        super_columns = _big_slice('key1', ColumnParent('Super1', 'sc2'))
+        client.remove(utf8encode('key1'), ColumnPath('Super1', utf8encode('sc2')), 5, ConsistencyLevel.ONE)
+        _expect_missing(lambda: client.get(utf8encode('key1'), ColumnPath('Super1', utf8encode('sc2'), _i64(5)), ConsistencyLevel.ONE))
+        super_columns = _big_slice(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')))
         assert super_columns == [], super_columns
-        super_columns_expected = [SuperColumn(name='sc1', columns=[Column(_i64(4), 'value4', 0)])]
+        super_columns_expected = [SuperColumn(name=utf8encode('sc1'), columns=[Column(_i64(4), utf8encode('value4'), 0)])]
         super_columns = [result.super_column
-                         for result in _big_slice('key1', ColumnParent('Super1'))]
+                         for result in _big_slice(utf8encode('key1'), ColumnParent('Super1'))]
         assert super_columns == super_columns_expected, super_columns
         _verify_simple()
 
         # Test resurrection.  First, re-insert the value w/ older timestamp,
         # and make sure it stays removed:
-        client.insert('key1', ColumnParent('Super1', 'sc2'), Column(_i64(5), 'value5', 1), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')), Column(_i64(5), utf8encode('value5'), 1), ConsistencyLevel.ONE)
         super_columns = [result.super_column
-                         for result in _big_slice('key1', ColumnParent('Super1'))]
+                         for result in _big_slice(utf8encode('key1'), ColumnParent('Super1'))]
         assert super_columns == super_columns_expected, super_columns
 
         # Next, w/ a newer timestamp; it should come back
-        client.insert('key1', ColumnParent('Super1', 'sc2'), Column(_i64(5), 'value5', 6), ConsistencyLevel.ONE)
+        client.insert(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')), Column(_i64(5), utf8encode('value5'), 6), ConsistencyLevel.ONE)
         super_columns = [result.super_column
-                         for result in _big_slice('key1', ColumnParent('Super1'))]
-        super_columns_expected = [SuperColumn(name='sc1', columns=[Column(_i64(4), 'value4', 0)]),
-                                  SuperColumn(name='sc2', columns=[Column(_i64(5), 'value5', 6)])]
+                         for result in _big_slice(utf8encode('key1'), ColumnParent('Super1'))]
+        super_columns_expected = [SuperColumn(name=utf8encode('sc1'), columns=[Column(_i64(4), utf8encode('value4'), 0)]),
+                                  SuperColumn(name=utf8encode('sc2'), columns=[Column(_i64(5), utf8encode('value5'), 6)])]
         assert super_columns == super_columns_expected, super_columns
 
         # check slicing at the subcolumn level too
-        p = SlicePredicate(slice_range=SliceRange('', '', False, 1000))
+        p = SlicePredicate(slice_range=SliceRange(utf8encode(''), utf8encode(''), False, 1000))
         columns = [result.column
-                   for result in client.get_slice('key1', ColumnParent('Super1', 'sc2'), p, ConsistencyLevel.ONE)]
-        assert columns == [Column(_i64(5), 'value5', 6)], columns
+                   for result in client.get_slice(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc2')), p, ConsistencyLevel.ONE)]
+        assert columns == [Column(_i64(5), utf8encode('value5'), 6)], columns
 
     def test_super_cf_resurrect_subcolumn(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1')
 
-        key = 'vijay'
-        client.insert(key, ColumnParent('Super1', 'sc1'), Column(_i64(4), 'value4', 0), ConsistencyLevel.ONE)
+        key = utf8encode('vijay')
+        client.insert(key, ColumnParent('Super1', utf8encode('sc1')), Column(_i64(4), utf8encode('value4'), 0), ConsistencyLevel.ONE)
 
-        client.remove(key, ColumnPath('Super1', 'sc1'), 1, ConsistencyLevel.ONE)
+        client.remove(key, ColumnPath('Super1', utf8encode('sc1')), 1, ConsistencyLevel.ONE)
 
-        client.insert(key, ColumnParent('Super1', 'sc1'), Column(_i64(4), 'value4', 2), ConsistencyLevel.ONE)
+        client.insert(key, ColumnParent('Super1', utf8encode('sc1')), Column(_i64(4), utf8encode('value4'), 2), ConsistencyLevel.ONE)
 
-        result = client.get(key, ColumnPath('Super1', 'sc1'), ConsistencyLevel.ONE)
+        result = client.get(key, ColumnPath('Super1', utf8encode('sc1')), ConsistencyLevel.ONE)
         assert result.super_column.columns is not None, result.super_column
 
     def test_empty_range(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Standard1', 'Super1')
 
-        assert get_range_slice(client, ColumnParent('Standard1'), SlicePredicate(column_names=['c1', 'c1']), '', '', 1000, ConsistencyLevel.ONE) == []
+        assert get_range_slice(client, ColumnParent('Standard1'), SlicePredicate(column_names=[utf8encode('c1'), utf8encode('c1')]), utf8encode(''), utf8encode(''), 1000, ConsistencyLevel.ONE) == []
         _insert_simple()
-        assert get_range_slice(client, ColumnParent('Super1'), SlicePredicate(column_names=['c1', 'c1']), '', '', 1000, ConsistencyLevel.ONE) == []
+        assert get_range_slice(client, ColumnParent('Super1'), SlicePredicate(column_names=[utf8encode('c1'), utf8encode('c1')]), utf8encode(''), utf8encode(''), 1000, ConsistencyLevel.ONE) == []
 
     @since('2.1')
     def test_super_cql_read_compatibility(self):
         _set_keyspace('Keyspace1')
         self.truncate_all('Super1')
 
-        _insert_super("key1")
-        _insert_super("key2")
+        _insert_super(utf8encode("key1"))
+        _insert_super(utf8encode("key2"))
 
         node1 = self.cluster.nodelist()[0]
         session = self.patient_cql_connection(node1)
@@ -1233,32 +1263,32 @@ class TestMutations(TestThrift):
         session.execute('USE "Keyspace1"')
 
         assert_all(session, "SELECT * FROM \"Super1\"",
-                   [["key1", "sc1", 4, "value4"],
-                    ["key1", "sc2", 5, "value5"],
-                    ["key1", "sc2", 6, "value6"],
-                    ["key2", "sc1", 4, "value4"],
-                    ["key2", "sc2", 5, "value5"],
-                    ["key2", "sc2", 6, "value6"]])
+                   [[utf8encode("key1"), utf8encode("sc1"), 4, utf8encode("value4")],
+                    [utf8encode("key1"), utf8encode("sc2"), 5, utf8encode("value5")],
+                    [utf8encode("key1"), utf8encode("sc2"), 6, utf8encode("value6")],
+                    [utf8encode("key2"), utf8encode("sc1"), 4, utf8encode("value4")],
+                    [utf8encode("key2"), utf8encode("sc2"), 5, utf8encode("value5")],
+                    [utf8encode("key2"), utf8encode("sc2"), 6, utf8encode("value6")]])
 
         assert_all(session, "SELECT * FROM \"Super1\" WHERE key=textAsBlob('key1')",
-                   [["key1", "sc1", 4, "value4"],
-                    ["key1", "sc2", 5, "value5"],
-                    ["key1", "sc2", 6, "value6"]])
+                   [[utf8encode("key1"), utf8encode("sc1"), 4, utf8encode("value4")],
+                    [utf8encode("key1"), utf8encode("sc2"), 5, utf8encode("value5")],
+                    [utf8encode("key1"), utf8encode("sc2"), 6, utf8encode("value6")]])
 
         assert_all(session, "SELECT * FROM \"Super1\" WHERE key=textAsBlob('key1') AND column1=textAsBlob('sc2')",
-                   [["key1", "sc2", 5, "value5"],
-                    ["key1", "sc2", 6, "value6"]])
+                   [[utf8encode("key1"), utf8encode("sc2"), 5, utf8encode("value5")],
+                    [utf8encode("key1"), utf8encode("sc2"), 6, utf8encode("value6")]])
 
         assert_all(session, "SELECT * FROM \"Super1\" WHERE key=textAsBlob('key1') AND column1=textAsBlob('sc2') AND column2 = 5",
-                   [["key1", "sc2", 5, "value5"]])
+                   [[

<TRUNCATED>

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message