当前位置: 首页>>代码示例>>Python>>正文


Python ColumnFamilyMap.get_indexed_slices方法代码示例

本文整理汇总了Python中pycassa.ColumnFamilyMap.get_indexed_slices方法的典型用法代码示例。如果您正苦于以下问题:Python ColumnFamilyMap.get_indexed_slices方法的具体用法?Python ColumnFamilyMap.get_indexed_slices怎么用?Python ColumnFamilyMap.get_indexed_slices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pycassa.ColumnFamilyMap的用法示例。


在下文中一共展示了ColumnFamilyMap.get_indexed_slices方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestColumnFamilyMap

# 需要导入模块: from pycassa import ColumnFamilyMap [as 别名]
# 或者: from pycassa.ColumnFamilyMap import get_indexed_slices [as 别名]
class TestColumnFamilyMap(unittest.TestCase):

    def setUp(self):
        self.map = ColumnFamilyMap(TestUTF8, pool, CF)
        self.indexed_map = ColumnFamilyMap(TestIndex, pool, INDEXED_CF)
        self.empty_map = ColumnFamilyMap(TestEmpty, pool, CF, raw_columns=True)

    def tearDown(self):
        for instance in self.map.get_range():
            self.map.remove(instance)
        for instance in self.indexed_map.get_range():
            self.indexed_map.remove(instance)

    def instance(self):
        instance = TestUTF8()
        instance.key = uuid.uuid4()
        instance.strcol = '1'
        instance.intcol = 2
        instance.floatcol = 3.5
        instance.datetimecol = datetime.now().replace(microsecond=0)

        return instance

    def test_empty(self):
        key = uuid.uuid4()
        assert_raises(NotFoundException, self.map.get, key)
        assert_equal(len(self.map.multiget([key])), 0)

    def test_insert_get(self):
        instance = self.instance()
        assert_raises(NotFoundException, self.map.get, instance.key)
        ts = self.map.insert(instance)
        assert_true(isinstance(ts, (int, long)))
        assert_equal(self.map.get(instance.key), instance)

    def test_insert_get_omitting_columns(self):
        """
        When omitting columns, pycassa should not try to insert the CassandraType
        instance on a ColumnFamilyMap object
        """
        instance2 = TestUTF8()
        instance2.key = uuid.uuid4()
        instance2.strcol = 'lol'
        instance2.intcol = 2
        assert_raises(NotFoundException, self.map.get, instance2.key)
        self.map.insert(instance2)
        ret_inst = self.map.get(instance2.key)
        assert_equal(ret_inst.key, instance2.key)
        assert_equal(ret_inst.strcol, instance2.strcol)
        assert_equal(ret_inst.intcol, instance2.intcol)

        ## these lines are commented out because, though they should work, wont
        ## because CassandraTypes are not descriptors when used on a ColumnFamilyMap
        ## instance, they are merely class attributes that are overwritten at runtime

        # assert_equal(ret_inst.floatcol, instance2.floatcol)
        # assert_equal(ret_inst.datetimecol, instance2.datetimecol)
        # assert_equal(self.map.get(instance2.key), instance2)

    def test_insert_get_indexed_slices(self):
        instance1 = TestIndex()
        instance1.key = 'key1'
        instance1.birthdate = 1L
        self.indexed_map.insert(instance1)

        instance2 = TestIndex()
        instance2.key = 'key2'
        instance2.birthdate = 1L
        self.indexed_map.insert(instance2)

        instance3 = TestIndex()
        instance3.key = 'key3'
        instance3.birthdate = 2L
        self.indexed_map.insert(instance3)

        expr = index.create_index_expression(column_name='birthdate', value=2L)
        clause = index.create_index_clause([expr])

        result = self.indexed_map.get_indexed_slices(index_clause=clause)
        count = 0
        for instance in result:
            assert_equal(instance, instance3)
            count += 1
        assert_equal(count, 1)

    def test_insert_multiget(self):
        instance1 = self.instance()
        instance2 = self.instance()
        missing_key = uuid.uuid4()

        self.map.insert(instance1)
        self.map.insert(instance2)
        rows = self.map.multiget([instance1.key, instance2.key, missing_key])
        assert_equal(len(rows), 2)
        assert_equal(rows[instance1.key], instance1)
        assert_equal(rows[instance2.key], instance2)
        assert_true(missing_key not in rows)

    def test_insert_get_range(self):
        if sys_man.describe_partitioner() == 'RandomPartitioner':
#.........这里部分代码省略.........
开发者ID:anisnasir,项目名称:pycassa,代码行数:103,代码来源:test_columnfamilymap.py

示例2: setUp

# 需要导入模块: from pycassa import ColumnFamilyMap [as 别名]
# 或者: from pycassa.ColumnFamilyMap import get_indexed_slices [as 别名]
class TestColumnFamilyMap:
    def setUp(self):
        self.map = ColumnFamilyMap(TestUTF8, cf)
        self.indexed_map = ColumnFamilyMap(TestIndex, indexed_cf)
        self.empty_map = ColumnFamilyMap(TestEmpty, cf, raw_columns=True)

    def tearDown(self):
        for key, columns in cf.get_range():
            cf.remove(key)
        for key, columns in indexed_cf.get_range():
            cf.remove(key)

    def instance(self, key):
        instance = TestUTF8()
        instance.key = key
        instance.strcol = '1'
        instance.intcol = 2
        instance.floatcol = 3.5
        instance.datetimecol = datetime.now().replace(microsecond=0)
        instance.intstrcol = 8
        instance.floatstrcol = 4.6
        instance.datetimestrcol = datetime.now().replace(microsecond=0)

        return instance

    def test_empty(self):
        key = 'TestColumnFamilyMap.test_empty'
        assert_raises(NotFoundException, self.map.get, key)
        assert_equal(len(self.map.multiget([key])), 0)

    def test_insert_get(self):
        instance = self.instance('TestColumnFamilyMap.test_insert_get')
        assert_raises(NotFoundException, self.map.get, instance.key)
        self.map.insert(instance)
        assert_equal(self.map.get(instance.key), instance)
        assert_equal(self.empty_map.get(instance.key).raw_columns['intstrcol'], str(instance.intstrcol))

    def test_insert_get_indexed_slices(self):
        instance1 = TestIndex()
        instance1.key = 'key1'
        instance1.birthdate = 1L
        self.indexed_map.insert(instance1)

        instance2 = TestIndex()
        instance2.key = 'key2'
        instance2.birthdate = 1L
        self.indexed_map.insert(instance2)

        instance3 = TestIndex()
        instance3.key = 'key3'
        instance3.birthdate = 2L
        self.indexed_map.insert(instance3)

        expr = index.create_index_expression(column_name='birthdate', value=2L)
        clause = index.create_index_clause([expr])

        result = self.indexed_map.get_indexed_slices(index_clause=clause)
        assert_equal(len(result), 1)
        assert_equal(result.get('key3'), instance3)

    def test_insert_multiget(self):
        instance1 = self.instance('TestColumnFamilyMap.test_insert_multiget1')
        instance2 = self.instance('TestColumnFamilyMap.test_insert_multiget2')
        missing_key = 'TestColumnFamilyMap.test_insert_multiget3'

        self.map.insert(instance1)
        self.map.insert(instance2)
        rows = self.map.multiget([instance1.key, instance2.key, missing_key])
        assert_equal(len(rows), 2)
        assert_equal(rows[instance1.key], instance1)
        assert_equal(rows[instance2.key], instance2)
        assert_true(missing_key not in rows)
        assert_equal(self.empty_map.multiget([instance1.key])[instance1.key].raw_columns['intstrcol'], str(instance1.intstrcol))

    def test_insert_get_range(self):
        if sys_man.describe_partitioner() == 'RandomPartitioner':
            raise SkipTest('Cannot use RandomPartitioner for this test')

        instances = []
        for i in xrange(5):
            instance = self.instance('TestColumnFamilyMap.test_insert_get_range%s' % i)
            instances.append(instance)

        for instance in instances:
            self.map.insert(instance)

        rows = list(self.map.get_range(start=instances[0].key, finish=instances[-1].key))
        assert_equal(len(rows), len(instances))
        assert_equal(rows, instances)
        assert_equal(list(self.empty_map.get_range(start=instances[0].key, finish=instances[0].key))[0].raw_columns['intstrcol'], str(instances[0].intstrcol))

    def test_remove(self):
        instance = self.instance('TestColumnFamilyMap.test_remove')

        self.map.insert(instance)
        self.map.remove(instance)
        assert_raises(NotFoundException, self.map.get, instance.key)

    def test_does_not_insert_extra_column(self):
        instance = self.instance('TestColumnFamilyMap.test_does_not_insert_extra_column')
#.........这里部分代码省略.........
开发者ID:amxn,项目名称:pycassa,代码行数:103,代码来源:test_columnfamilymap.py

示例3: setUp

# 需要导入模块: from pycassa import ColumnFamilyMap [as 别名]
# 或者: from pycassa.ColumnFamilyMap import get_indexed_slices [as 别名]
class TestColumnFamilyMap:
    def setUp(self):
        self.map = ColumnFamilyMap(TestUTF8, pool, CF)
        self.indexed_map = ColumnFamilyMap(TestIndex, pool, INDEXED_CF)
        self.empty_map = ColumnFamilyMap(TestEmpty, pool, CF, raw_columns=True)

    def tearDown(self):
        for instance in self.map.get_range():
            self.map.remove(instance)
        for instance in self.indexed_map.get_range():
            self.indexed_map.remove(instance)

    def instance(self, key):
        instance = TestUTF8()
        instance.key = key
        instance.strcol = "1"
        instance.intcol = 2
        instance.floatcol = 3.5
        instance.datetimecol = datetime.now().replace(microsecond=0)

        return instance

    def test_empty(self):
        key = "TestColumnFamilyMap.test_empty"
        assert_raises(NotFoundException, self.map.get, key)
        assert_equal(len(self.map.multiget([key])), 0)

    def test_insert_get(self):
        instance = self.instance("TestColumnFamilyMap.test_insert_get")
        assert_raises(NotFoundException, self.map.get, instance.key)
        self.map.insert(instance)
        assert_equal(self.map.get(instance.key), instance)

    def test_insert_get_indexed_slices(self):
        instance1 = TestIndex()
        instance1.key = "key1"
        instance1.birthdate = 1L
        self.indexed_map.insert(instance1)

        instance2 = TestIndex()
        instance2.key = "key2"
        instance2.birthdate = 1L
        self.indexed_map.insert(instance2)

        instance3 = TestIndex()
        instance3.key = "key3"
        instance3.birthdate = 2L
        self.indexed_map.insert(instance3)

        expr = index.create_index_expression(column_name="birthdate", value=2L)
        clause = index.create_index_clause([expr])

        result = self.indexed_map.get_indexed_slices(index_clause=clause)
        assert_equal(len(result), 1)
        assert_equal(result.get("key3"), instance3)

    def test_insert_multiget(self):
        instance1 = self.instance("TestColumnFamilyMap.test_insert_multiget1")
        instance2 = self.instance("TestColumnFamilyMap.test_insert_multiget2")
        missing_key = "TestColumnFamilyMap.test_insert_multiget3"

        self.map.insert(instance1)
        self.map.insert(instance2)
        rows = self.map.multiget([instance1.key, instance2.key, missing_key])
        assert_equal(len(rows), 2)
        assert_equal(rows[instance1.key], instance1)
        assert_equal(rows[instance2.key], instance2)
        assert_true(missing_key not in rows)

    def test_insert_get_range(self):
        if sys_man.describe_partitioner() == "RandomPartitioner":
            raise SkipTest("Cannot use RandomPartitioner for this test")

        instances = []
        for i in xrange(5):
            instance = self.instance("TestColumnFamilyMap.test_insert_get_range%s" % i)
            instances.append(instance)

        for instance in instances:
            self.map.insert(instance)

        rows = list(self.map.get_range(start=instances[0].key, finish=instances[-1].key))
        assert_equal(len(rows), len(instances))
        assert_equal(rows, instances)

    def test_remove(self):
        instance = self.instance("TestColumnFamilyMap.test_remove")

        self.map.insert(instance)
        self.map.remove(instance)
        assert_raises(NotFoundException, self.map.get, instance.key)

    def test_does_not_insert_extra_column(self):
        instance = self.instance("TestColumnFamilyMap.test_does_not_insert_extra_column")
        instance.othercol = "Test"

        self.map.insert(instance)

        get_instance = self.map.get(instance.key)
        assert_equal(get_instance.strcol, instance.strcol)
#.........这里部分代码省略.........
开发者ID:bwhite,项目名称:pycassa,代码行数:103,代码来源:test_columnfamilymap.py

示例4: setUp

# 需要导入模块: from pycassa import ColumnFamilyMap [as 别名]
# 或者: from pycassa.ColumnFamilyMap import get_indexed_slices [as 别名]
class TestColumnFamilyMap:
    def setUp(self):
        credentials = {'username': 'jsmith', 'password': 'havebadpass'}
        self.pool = ConnectionPool(keyspace='Keyspace1', credentials=credentials)
        self.cf = ColumnFamily(self.pool, 'Standard2',
                               autopack_names=False,
                               autopack_values=False)
        self.indexed_cf = ColumnFamily(self.pool, 'Indexed1',
                                       autopack_names=False,
                                       autopack_values=False)
        self.map = ColumnFamilyMap(TestUTF8, self.cf)
        self.indexed_map = ColumnFamilyMap(TestIndex, self.indexed_cf)
        self.empty_map = ColumnFamilyMap(TestEmpty, self.cf, raw_columns=True)

    def tearDown(self):
        for key, columns in self.cf.get_range():
            self.cf.remove(key)
        for key, columns in self.indexed_cf.get_range():
            self.cf.remove(key)

    def instance(self, key):
        instance = TestUTF8()
        instance.key = key
        instance.strcol = '1'
        instance.intcol = 2
        instance.floatcol = 3.5
        instance.datetimecol = datetime.now().replace(microsecond=0)
        instance.intstrcol = 8
        instance.floatstrcol = 4.6
        instance.datetimestrcol = datetime.now().replace(microsecond=0)

        return instance

    def test_empty(self):
        key = 'TestColumnFamilyMap.test_empty'
        assert_raises(NotFoundException, self.map.get, key)
        assert_equal(len(self.map.multiget([key])), 0)

    def test_insert_get(self):
        instance = self.instance('TestColumnFamilyMap.test_insert_get')
        assert_raises(NotFoundException, self.map.get, instance.key)
        self.map.insert(instance)
        assert_equal(self.map.get(instance.key), instance)
        assert_equal(self.empty_map.get(instance.key).raw_columns['intstrcol'], str(instance.intstrcol))

    def test_insert_get_indexed_slices(self):
        instance = TestIndex()
        instance.key = 'key'
        instance.birthdate = 1L
        self.indexed_map.insert(instance)
        instance.key = 'key2'
        self.indexed_map.insert(instance)
        instance.key = 'key3'
        self.indexed_map.insert(instance)

        expr = index.create_index_expression(column_name='birthdate', value=1L)
        clause = index.create_index_clause([expr])
        result = self.indexed_map.get_indexed_slices(instance, index_clause=clause)
        assert_equal(len(result), 3)
        assert_equal(result.get('key3'), instance)

    def test_insert_multiget(self):
        instance1 = self.instance('TestColumnFamilyMap.test_insert_multiget1')
        instance2 = self.instance('TestColumnFamilyMap.test_insert_multiget2')
        missing_key = 'TestColumnFamilyMap.test_insert_multiget3'

        self.map.insert(instance1)
        self.map.insert(instance2)
        rows = self.map.multiget([instance1.key, instance2.key, missing_key])
        assert_equal(len(rows), 2)
        assert_equal(rows[instance1.key], instance1)
        assert_equal(rows[instance2.key], instance2)
        assert_true(missing_key not in rows)
        assert_equal(self.empty_map.multiget([instance1.key])[instance1.key].raw_columns['intstrcol'], str(instance1.intstrcol))

    def test_insert_get_count(self):
        instance = self.instance('TestColumnFamilyMap.test_insert_get_count')
        self.map.insert(instance)
        assert_equal(self.map.get_count(instance.key), 7)

    def test_insert_get_range(self):
        instances = []
        for i in xrange(5):
            instance = self.instance('TestColumnFamilyMap.test_insert_get_range%s' % i)
            instances.append(instance)

        for instance in instances:
            self.map.insert(instance)

        rows = list(self.map.get_range(start=instances[0].key, finish=instances[-1].key))
        assert_equal(len(rows), len(instances))
        assert_equal(rows, instances)
        assert_equal(list(self.empty_map.get_range(start=instances[0].key, finish=instances[0].key))[0].raw_columns['intstrcol'], str(instances[0].intstrcol))

    def test_remove(self):
        instance = self.instance('TestColumnFamilyMap.test_remove')

        self.map.insert(instance)
        self.map.remove(instance)
        assert_raises(NotFoundException, self.map.get, instance.key)
#.........这里部分代码省略.........
开发者ID:trhowe,项目名称:pycassa,代码行数:103,代码来源:test_columnfamilymap.py

示例5: TestColumnFamilyMap

# 需要导入模块: from pycassa import ColumnFamilyMap [as 别名]
# 或者: from pycassa.ColumnFamilyMap import get_indexed_slices [as 别名]
class TestColumnFamilyMap(unittest.TestCase):
    def setUp(self):
        self.map = ColumnFamilyMap(TestUTF8, pool, CF)
        self.indexed_map = ColumnFamilyMap(TestIndex, pool, INDEXED_CF)
        self.empty_map = ColumnFamilyMap(TestEmpty, pool, CF, raw_columns=True)

    def tearDown(self):
        for instance in self.map.get_range():
            self.map.remove(instance)
        for instance in self.indexed_map.get_range():
            self.indexed_map.remove(instance)

    def instance(self, key):
        instance = TestUTF8()
        instance.key = key
        instance.strcol = "1"
        instance.intcol = 2
        instance.floatcol = 3.5
        instance.datetimecol = datetime.now().replace(microsecond=0)

        return instance

    def test_empty(self):
        key = "TestColumnFamilyMap.test_empty"
        assert_raises(NotFoundException, self.map.get, key)
        assert_equal(len(self.map.multiget([key])), 0)

    def test_insert_get(self):
        instance = self.instance("TestColumnFamilyMap.test_insert_get")
        assert_raises(NotFoundException, self.map.get, instance.key)
        ts = self.map.insert(instance)
        assert_true(isinstance(ts, int))
        assert_equal(self.map.get(instance.key), instance)

    def test_insert_get_omitting_columns(self):
        r"""
        When omitting columns, pycassa should not try to insert the CassandraType
        instance on a ColumnFamilyMap object
        """
        instance2 = TestUTF8()
        instance2.key = "TestColumnFamilyMap.test_insert_get_2"
        instance2.strcol = "lol"
        instance2.intcol = 2
        assert_raises(NotFoundException, self.map.get, instance2.key)
        self.map.insert(instance2)
        ret_inst = self.map.get(instance2.key)
        assert_equal(ret_inst.key, instance2.key)
        assert_equal(ret_inst.strcol, instance2.strcol)
        assert_equal(ret_inst.intcol, instance2.intcol)

        ## these lines are commented out because, though they should work, wont
        ## because CassandraTypes are not descriptors when used on a ColumnFamilyMap
        ## instance, they are merely class attributes that are overwritten at runtime

        # assert_equal(ret_inst.floatcol, instance2.floatcol)
        # assert_equal(ret_inst.datetimecol, instance2.datetimecol)
        # assert_equal(self.map.get(instance2.key), instance2)

    def test_insert_get_indexed_slices(self):
        instance1 = TestIndex()
        instance1.key = "key1"
        instance1.birthdate = 1L
        self.indexed_map.insert(instance1)

        instance2 = TestIndex()
        instance2.key = "key2"
        instance2.birthdate = 1L
        self.indexed_map.insert(instance2)

        instance3 = TestIndex()
        instance3.key = "key3"
        instance3.birthdate = 2L
        self.indexed_map.insert(instance3)

        expr = index.create_index_expression(column_name="birthdate", value=2L)
        clause = index.create_index_clause([expr])

        result = self.indexed_map.get_indexed_slices(index_clause=clause)
        count = 0
        for instance in result:
            assert_equal(instance, instance3)
            count += 1
        assert_equal(count, 1)

    def test_insert_multiget(self):
        instance1 = self.instance("TestColumnFamilyMap.test_insert_multiget1")
        instance2 = self.instance("TestColumnFamilyMap.test_insert_multiget2")
        missing_key = "TestColumnFamilyMap.test_insert_multiget3"

        self.map.insert(instance1)
        self.map.insert(instance2)
        rows = self.map.multiget([instance1.key, instance2.key, missing_key])
        assert_equal(len(rows), 2)
        assert_equal(rows[instance1.key], instance1)
        assert_equal(rows[instance2.key], instance2)
        assert_true(missing_key not in rows)

    def test_insert_get_range(self):
        if sys_man.describe_partitioner() == "RandomPartitioner":
            raise SkipTest("Cannot use RandomPartitioner for this test")
#.........这里部分代码省略.........
开发者ID:bshanks,项目名称:pycassa,代码行数:103,代码来源:test_columnfamilymap.py

示例6: setUp

# 需要导入模块: from pycassa import ColumnFamilyMap [as 别名]
# 或者: from pycassa.ColumnFamilyMap import get_indexed_slices [as 别名]
class TestColumnFamilyMap:
    def setUp(self):
        credentials = {'username': 'jsmith', 'password': 'havebadpass'}
        self.client = connect('Keyspace1', credentials=credentials)
        self.cf = ColumnFamily(self.client, 'Standard2',
                               write_consistency_level=ConsistencyLevel.ONE,
                               timestamp=self.timestamp,
                               autopack_names=False,
                               autopack_values=False)
        self.indexed_cf = ColumnFamily(self.client, 'Indexed1',
                                       autopack_names=False,
                                       autopack_values=False)
        self.map = ColumnFamilyMap(TestUTF8, self.cf)
        self.indexed_map = ColumnFamilyMap(TestIndex, self.indexed_cf)
        self.empty_map = ColumnFamilyMap(TestEmpty, self.cf, raw_columns=True)
        try:
            self.timestamp_n = int(self.cf.get('meta')['timestamp'])
        except NotFoundException:
            self.timestamp_n = 0
        self.clear()

    def tearDown(self):
        self.cf.insert('meta', {'timestamp': str(self.timestamp_n)})

    # Since the timestamp passed to Cassandra will be in the same second
    # with the default timestamp function, causing problems with removing
    # and inserting (Cassandra doesn't know which is later), we supply our own
    def timestamp(self):
        self.timestamp_n += 1
        return self.timestamp_n

    def clear(self):
        for key, columns in self.cf.get_range(include_timestamp=True):
            for value, timestamp in columns.itervalues():
                self.timestamp_n = max(self.timestamp_n, timestamp)
            self.cf.remove(key)

    def instance(self, key):
        instance = TestUTF8()
        instance.key = key
        instance.strcol = '1'
        instance.intcol = 2
        instance.floatcol = 3.5
        instance.datetimecol = datetime.now().replace(microsecond=0)
        instance.intstrcol = 8
        instance.floatstrcol = 4.6
        instance.datetimestrcol = datetime.now().replace(microsecond=0)

        return instance

    def test_empty(self):
        key = 'TestColumnFamilyMap.test_empty'
        assert_raises(NotFoundException, self.map.get, key)
        assert len(self.map.multiget([key])) == 0

    def test_insert_get(self):
        instance = self.instance('TestColumnFamilyMap.test_insert_get')
        assert_raises(NotFoundException, self.map.get, instance.key)
        self.map.insert(instance)
        assert self.map.get(instance.key) == instance
        assert self.empty_map.get(instance.key).raw_columns['intstrcol'] == str(instance.intstrcol)

    def test_insert_get_indexed_slices(self):
        instance = TestIndex()
        instance.key = 'key'
        instance.birthdate = 1L
        self.indexed_map.insert(instance)
        instance.key = 'key2'
        self.indexed_map.insert(instance)
        instance.key = 'key3'
        self.indexed_map.insert(instance)

        expr = index.create_index_expression(column_name='birthdate', value=1L)
        clause = index.create_index_clause([expr])
        result = self.indexed_map.get_indexed_slices(instance, index_clause=clause)
        assert len(result) == 3
        assert result.get('key3') == instance

    def test_insert_multiget(self):
        instance1 = self.instance('TestColumnFamilyMap.test_insert_multiget1')
        instance2 = self.instance('TestColumnFamilyMap.test_insert_multiget2')
        missing_key = 'TestColumnFamilyMap.test_insert_multiget3'

        self.map.insert(instance1)
        self.map.insert(instance2)
        rows = self.map.multiget([instance1.key, instance2.key, missing_key])
        assert len(rows) == 2
        assert rows[instance1.key] == instance1
        assert rows[instance2.key] == instance2
        assert missing_key not in rows
        assert self.empty_map.multiget([instance1.key])[instance1.key].raw_columns['intstrcol'] == str(instance1.intstrcol)

    def test_insert_get_count(self):
        instance = self.instance('TestColumnFamilyMap.test_insert_get_count')
        self.map.insert(instance)
        assert self.map.get_count(instance.key) == 7

    def test_insert_get_range(self):
        instances = []
        for i in xrange(5):
#.........这里部分代码省略.........
开发者ID:dln,项目名称:pycassa,代码行数:103,代码来源:test_columnfamilymap.py


注:本文中的pycassa.ColumnFamilyMap.get_indexed_slices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。