def test_signed_int_64(self): self.assertRaises(couchbase.exceptions.ArgumentError, SignedInt64, -0x7FFFFFFFFFFFFFFF-2) self.assertRaises(couchbase.exceptions.ArgumentError, SignedInt64, 0x7FFFFFFFFFFFFFFF + 1) x=SignedInt64(0x7FFFFFFFFFFFFFFF) self.assertEqual(0x7FFFFFFFFFFFFFFF,x.value) x=SignedInt64(-0x7FFFFFFFFFFFFFFF-1) self.assertEqual(-0x7FFFFFFFFFFFFFFF-1,x.value)
def test_increment(self): try: self.coll.remove("counter",quiet=True) except: pass self.coll.increment("counter", DeltaValue(0), initial=SignedInt64(43)) self.assertEqual(43,self.coll.get("counter").content_as[int]) self.coll.increment("counter", DeltaValue(1)) self.assertEqual(44,self.coll.get("counter").content_as[int]) self.coll.remove("counter") self.coll.upsert("counter", 43) self.coll.increment("counter", DeltaValue(1)) self.assertEqual(44,self.coll.get("counter").content_as[int]) self.assertRaises(couchbase.exceptions.ArgumentError, self.coll.increment, "counter", DeltaValue(5), initial=10) self.assertRaises(couchbase.exceptions.ArgumentError, self.coll.increment, "counter", 5) self.assertRaises(couchbase.exceptions.ArgumentError, self.coll.increment, "counter", -3)