Esempio n. 1
0
    def setUp(self):
        self.row_data = list(
            lzb.pack(columns(((str(uuid.uuid4()), random.randint(0, 10000)) for x in range(100)), util.timestamp()))
        )

        self.array = Array(lzb.Key("Keyspace", "Colfam", "Rowkey"))
        self.array._slice_iterator = lambda *args, **kwargs: (
            kwargs.get("reverse") and reversed(self.row_data) or iter(self.row_data)
        )

        fake_cas = type("FakeCas", (), {"get_count": lambda *args: len(self.row_data)})
        self.array._get_cas = fake_cas
Esempio n. 2
0
    def test_columns(self):
        """Test iterators.tuples.""" 	
        tuples = [(str(uuid.uuid4()), random.randint(0, 10000))
                  for x in range(100)]

        cols = iterators.columns(tuples, 0)	 	
        self.assert_(isinstance(cols, types.GeneratorType))
        cols = list(cols)
        self.assert_(len(tuples) == len(cols))	 	
        for (idx, col) in enumerate(cols):
            self.assert_(tuples[idx][0] == col.name)
            self.assert_(tuples[idx][1] == col.value)
            self.assert_(col.timestamp == 0)
Esempio n. 3
0
    def setUp(self):
        self.row_data = list(
            lzb.pack(
                columns(((str(uuid.uuid4()), random.randint(0, 10000))
                         for x in range(100)), util.timestamp())))

        self.array = Array(lzb.Key("Keyspace", "Colfam", "Rowkey"))
        self.array._slice_iterator = lambda *args, **kwargs: \
            (kwargs.get('reverse') and reversed(self.row_data)
             or iter(self.row_data))

        fake_cas = type('FakeCas', (),
                        {'get_count': lambda *args: len(self.row_data)})
        self.array._get_cas = fake_cas