本文整理匯總了Python中AerospikeClientMock.AerospikeClientMock.get方法的典型用法代碼示例。如果您正苦於以下問題:Python AerospikeClientMock.get方法的具體用法?Python AerospikeClientMock.get怎麽用?Python AerospikeClientMock.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AerospikeClientMock.AerospikeClientMock
的用法示例。
在下文中一共展示了AerospikeClientMock.get方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_remove_bin
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_remove_bin(self):
default_ttl = 2
asm = AerospikeClientMock(default_ttl=2)
key = ("a", "b", "c")
asm.put(key, {"a": 1, "b": 1, "c": 1, "d": 1})
self.assertEquals({('a', 'b', 'c'): {'a': 1, 'c': 1, 'b': 1, 'd': 1}},
asm.dump())
self.assertEqual(
(
('a', 'b', 'c'), {'a': 1, 'c': 1, 'b': 1, 'd': 1},
{'gen': 1, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
asm.remove_bin(key, ["b", "d"], meta={"ttl": 4})
self.assertEquals({('a', 'b', 'c'): {'a': 1, 'c': 1}}, asm.dump())
self.assertEqual(
(
('a', 'b', 'c'), {'a': 1, 'c': 1},
{'gen': 2, 'ttl': self.get_time(4)}
), asm.get(key))
asm.remove_bin(key, ["c"])
self.assertEquals({('a', 'b', 'c'): {'a': 1}}, asm.dump())
self.assertEqual(
(
('a', 'b', 'c'), {'a': 1},
{'gen': 3, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
示例2: test_get
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_get(self):
asm = AerospikeClientMock()
key = ("a", "b", "c")
asm.put(key, {"a": 1})
self.assertEqual((('a', 'b', 'c'), {'gen': 1, 'ttl': 0}, {'a': 1}),
asm.get(key))
# test if not changing gen
self.assertEqual((('a', 'b', 'c'), {'gen': 1, 'ttl': 0}, {'a': 1}),
asm.get(key))
示例3: test_undefined_incr
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_undefined_incr(self):
asm = AerospikeClientMock()
key = ("a", "b", "c")
asm.increment(key, "a", 1)
self.assertEqual({('a', 'b', 'c'): {'a': 1}}, asm.dump())
self.assertEqual((('a', 'b', 'c'), {'gen': 1, 'ttl': 0}, {'a': 1}),
asm.get(key))
asm.increment(key, "b", 1)
self.assertEqual({('a', 'b', 'c'): {'a': 1, 'b': 1}}, asm.dump())
self.assertEqual((('a', 'b', 'c'), {'gen': 2, 'ttl': 0}, {'a': 1, 'b': 1}),
asm.get(key))
示例4: test_put
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_put(self):
asm = AerospikeClientMock()
key = ("a", "b", "c")
asm.put(key, {"a": 1})
self.assertEqual({('a', 'b', 'c'): {'a': 1}}, asm.dump())
self.assertEqual((('a', 'b', 'c'), {'gen': 1, 'ttl': 0}, {'a': 1}),
asm.get(key))
asm.put(key, {"b": 1})
self.assertEqual({('a', 'b', 'c'): {'a': 1, 'b': 1}}, asm.dump())
self.assertEqual((('a', 'b', 'c'), {'gen': 2, 'ttl': 0}, {'a': 1, 'b': 1}),
asm.get(key))
示例5: test_get
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_get(self):
default_ttl = 2
asm = AerospikeClientMock(default_ttl=2)
key = ("a", "b", "c")
asm.put(key, {"a": 1})
self.assertEqual(
(
('a', 'b', 'c'), {'a': 1},
{'gen': 1, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
# test whether not changing gen
self.assertEqual(
(
('a', 'b', 'c'), {'a': 1},
{'gen': 1, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
示例6: test_incr
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_incr(self):
default_ttl = 2
asm = AerospikeClientMock(default_ttl=2)
key = ("a", "b", "c")
asm.put(key, {"a": 1})
asm.increment(key, "a", 2)
self.assertEqual({('a', 'b', 'c'): {'a': 3}}, asm.dump())
self.assertEqual(
(
('a', 'b', 'c'), {'a': 3},
{'gen': 2, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
asm.increment(key, "a", 1, meta={"ttl": 1})
self.assertEqual(
(('a', 'b', 'c'), {'a': 4}, {'gen': 3, 'ttl': self.get_time(1)}),
asm.get(key))
示例7: test_incr_value
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_incr_value(self):
asm = AerospikeClientMock()
key = ("a", "b", "c")
asm.put(key, {"a": 1})
asm.increment(key, "a", 2)
self.assertEqual({('a', 'b', 'c'): {'a': 3}}, asm.dump())
self.assertEqual((('a', 'b', 'c'), {'gen': 2, 'ttl': 0}, {'a': 3}),
asm.get(key))
示例8: test_prepend
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_prepend(self):
asm = AerospikeClientMock()
key = ("a", "b", "c")
asm.put(key, {"word": "hell"})
asm.append(key, "word", "o")
self.assertEqual({('a', 'b', 'c'): {'word': 'hello'}}, asm.dump())
self.assertEqual(
(('a', 'b', 'c'), {'gen': 2, 'ttl': 0}, {'word': 'hello'}),
asm.get(key))
示例9: test_remove_bin
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_remove_bin(self):
asm = AerospikeClientMock()
key = ("a", "b", "c")
asm.put(key, {"a": 1, "b": 1, "c": 1, "d": 1})
self.assertEquals({('a', 'b', 'c'): {'a': 1, 'c': 1, 'b': 1, 'd': 1}},
asm.dump())
self.assertEqual(
(
('a', 'b', 'c'), {'gen': 1, 'ttl': 0},
{'a': 1, 'c': 1, 'b': 1, 'd': 1}
), asm.get(key))
asm.remove_bin(key, ["b", "d"])
self.assertEquals({('a', 'b', 'c'): {'a': 1, 'c': 1}}, asm.dump())
self.assertEqual(
(('a', 'b', 'c'), {'gen': 2, 'ttl': 0}, {'a': 1, 'c': 1}),
asm.get(key))
asm.remove_bin(key, ["c"])
self.assertEquals({('a', 'b', 'c'): {'a': 1}}, asm.dump())
self.assertEqual((('a', 'b', 'c'), {'gen': 3, 'ttl': 0}, {'a': 1}),
asm.get(key))
示例10: test_undefined_incr
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_undefined_incr(self):
default_ttl = 2
asm = AerospikeClientMock(default_ttl=2)
key = ("a", "b", "c")
asm.increment(key, "a", 1)
self.assertEqual({('a', 'b', 'c'): {'a': 1}}, asm.dump())
self.assertEqual(
(
('a', 'b', 'c'), {'a': 1},
{'gen': 1, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
示例11: test_append
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_append(self):
default_ttl = 2
asm = AerospikeClientMock(default_ttl=2)
key = ("a", "b", "c")
asm.put(key, {"word": "ello"})
asm.prepend(key, "word", "h")
self.assertEqual({('a', 'b', 'c'): {'word': 'hello'}}, asm.dump())
self.assertEqual(
(
('a', 'b', 'c'), {'word': 'hello'},
{'gen': 2, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
示例12: test_touch
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_touch(self):
default_ttl = 2
asm = AerospikeClientMock(default_ttl=2)
key = ("a", "b", "c")
asm.put(key, {"a": 1})
self.assertEquals(
(
('a', 'b', 'c'), {'a': 1},
{'gen': 1, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
time.sleep(1)
asm.touch(key)
self.assertEquals(
(
('a', 'b', 'c'), {'a': 1},
{'gen': 2, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
asm.touch(key, 4)
self.assertEquals(
(('a', 'b', 'c'), {'a': 1}, {'gen': 3, 'ttl': self.get_time(4)}),
asm.get(key))
示例13: test_put
# 需要導入模塊: from AerospikeClientMock import AerospikeClientMock [as 別名]
# 或者: from AerospikeClientMock.AerospikeClientMock import get [as 別名]
def test_put(self):
default_ttl = 2
asm = AerospikeClientMock(default_ttl=2)
key = ("a", "b", "c")
asm.put(key, {"a": 1})
self.assertEqual({('a', 'b', 'c'): {'a': 1}}, asm.dump())
self.assertEqual(
(
('a', 'b', 'c'), {'a': 1},
{'gen': 1, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
time.sleep(1)
asm.put(key, {"a": 1})
self.assertEqual(
(
('a', 'b', 'c'), {'a': 1},
{'gen': 1, 'ttl': self.get_time(default_ttl)}
), asm.get(key))
asm.put(key, {"a": 1}, meta={"ttl": 1})
self.assertEqual(
(('a', 'b', 'c'), {'a': 1}, {'gen': 1, 'ttl': self.get_time(1)}),
asm.get(key))