Author: eevans Date: Sat Mar 19 02:09:44 2011 New Revision: 1083128 URL: http://svn.apache.org/viewvc?rev=1083128&view=rev Log: better utf8 CQL system tests
Patch by eevans Modified: cassandra/trunk/test/system/test_cql.py Modified: cassandra/trunk/test/system/test_cql.py URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_cql.py?rev=1083128&r1=1083127&r2=1083128&view=diff ============================================================================== --- cassandra/trunk/test/system/test_cql.py (original) +++ cassandra/trunk/test/system/test_cql.py Sat Mar 19 02:09:44 2011 @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -24,8 +25,8 @@ sys.path.append(join(abspath(dirname(__f from cql import Connection from cql.errors import CQLException -from . import ThriftTester -from . import thrift_client # TODO: temporary +from __init__ import ThriftTester +from __init__ import thrift_client # TODO: temporary def assert_raises(exception, method, *args): try: @@ -79,13 +80,6 @@ def load_sample(dbconn): dbconn.execute(query, "cd1", "vd1", "col", "val", "kd") dbconn.execute(""" - UPDATE StandardUtf82 SET '%s' = 've1', 'col' = 'val' WHERE KEY = 'kd' - """ % u'\xa9'.encode('utf8')) - dbconn.execute(""" - UPDATE StandardUtf82 SET 'cf1' = 'vf1', 'col' = 'val' WHERE KEY = 'kd' - """) - - dbconn.execute(""" BEGIN BATCH USING CONSISTENCY ONE UPDATE StandardLongA SET 1='1', 2='2', 3='3', 4='4' WHERE KEY='aa'; UPDATE StandardLongA SET 5='5', 6='6', 7='8', 9='9' WHERE KEY='ab'; @@ -525,4 +519,28 @@ class TestCql(ThriftTester): assert r[0].columns[0].name == uid.bytes # TODO: slices of uuids from cf w/ LexicalUUIDType comparator + + def test_utf8_read_write(self): + "reading and writing utf8 values" + conn = init() + # Sorting: ¢ (u00a2) < © (u00a9) < ® (u00ae) < ¿ (u00bf) + conn.execute("UPDATE StandardUtf82 SET ? = v1 WHERE KEY = k1", "¿") + conn.execute("UPDATE StandardUtf82 SET ? = v1 WHERE KEY = k1", "©") + conn.execute("UPDATE StandardUtf82 SET ? = v1 WHERE KEY = k1", "®") + conn.execute("UPDATE StandardUtf82 SET ? = v1 WHERE KEY = k1", "¢") + + r = conn.execute("SELECT * FROM StandardUtf82 WHERE KEY = k1") + assert r[0][0].name == "¢" + assert r[0][1].name == "©" + assert r[0][2].name == "®" + assert r[0][3].name == "¿" + + r = conn.execute("SELECT ?..'' FROM StandardUtf82 WHERE KEY = k1", "©") + assert len(r[0]) == 3 + assert r[0][0].name == "©" + assert r[0][1].name == "®" + assert r[0][2].name == "¿" + + +