def test_deleted_element_by_an_uncommited_transaction(self):
     element = MVCCDocument.create(
         self.txn,
         {'key': 'value'}
     )
     element.save()
     
     element.expire_ts(True)
     txn = Transaction(ts=2)
     element = MVCCDocument.load(txn, element.identifier)
     element.expire_ts(True)
     element.save()
     txn = Transaction(ts=3)
     self.assertTrue(MVCCDocument.load(txn, element.identifier))
 def test_load_save(self):
     element = MVCCDocument.create(
         self.txn,
         {'key': 'value'}
     )
     element.save()
     element = MVCCDocument.load(self.txn, element.identifier)
     self.assertEqual(element.get('key'), 'value')
 def test_load_latest_version(self):
     element = MVCCDocument.create(
         self.txn,
         {'key': 'value'}
     )
     element.save()
     for x in range(10):
         element.set('key', x)
     element = MVCCDocument.load(self.txn, element.identifier)
     self.assertEqual(element.get('key'), 9)
 def test_delete_element(self):
     element = MVCCDocument.create(
         self.txn,
         {'key': 'value'}
     )
     element.save()
     txn = Transaction(ts=2)
     element = MVCCDocument.load(txn, element.identifier)
     element.expire_ts(True)
     element.save()
     txn = Transaction(ts=3)
     txn.commited_ts = [1, 2]
     self.assertRaises(
         ElementNotFound,
         MVCCDocument.load,
         txn,
         element.identifier
     )