def test_newkey(self): return old = pongo.meta(self.db, '.newkey', _newkey) self.assertEqual(self.db.set(pongo.id, {}), 'foo-1') self.assertEqual(self.db.set(pongo.id, {}), 'foo-2') self.assertEqual(self.db.set(pongo.id, {}), 'foo-3') pongo.meta(self.db, '.newkey', old)
def setUp(self): self.db = pongo.open('test.db') # We don't need full 2-phase commit for the test program pongo.meta(self.db, '.sync', 0) self.primitive = { "null": None, "true": True, "false": False, "int-0": 0, "int-1": 1, "int-huge": 2**32, "now": datetime.utcnow(), "uuid": uuid.uuid1(), "float-0": 0.0, "float-2": 2.0, # The current implementation sacrifices the 4 least significant # bits of a double, so this constant won't compare exactly #"float-avagadro": 6.022e23, "str": "The quick brown fox", "unicode": u"Fuzzy Wuzzy was a bear" } self.db['primitive'] = self.primitive self.db['list'] = [1,2,3,4,5,6]
def setUp(self): self.db = pongo.open('test.db') # We don't need full 2-phase commit for the test program pongo.meta(self.db, '.sync', 0) self.primitive = { "null": None, "true": True, "false": False, "int-0": 0, "int-1": 1, "int-huge": 2**32, "now": datetime.utcnow(), "uuid": uuid.uuid1(), "float-0": 0.0, "float-2": 2.0, # The current implementation sacrifices the 4 least significant # bits of a double, so this constant won't compare exactly #"float-avagadro": 6.022e23, "str": "The quick brown fox", "unicode": u"Fuzzy Wuzzy was a bear" } self.db['primitive'] = self.primitive self.db['list'] = [1, 2, 3, 4, 5, 6]
def test_meta(self): self.assertEqual(pongo.meta(self.db, 'chunksize'), 16*1024*1024) self.assertEqual(pongo.meta(self.db, 'id'), "_id")
def test_meta(self): self.assertEqual(pongo.meta(self.db, 'chunksize'), 16 * 1024 * 1024) self.assertEqual(pongo.meta(self.db, 'id'), "_id")