Exemplo n.º 1
0
    def delete(self, **options):
        """Synchronously delete the entity for this key.

        This is a no-op if no such entity exists.

        Note:
            If in a transaction, the entity can only be deleted at transaction
            commit time. In that case, this function will schedule the entity
            to be deleted as part of the transaction and will return
            immediately, which is effectively the same as calling
            :meth:`delete_async` and ignoring the returned future. If not in a
            transaction, this function will block synchronously until the
            entity is deleted, as one would expect.

        Args:
            options (Dict[str, Any]): The context options for the request.
                For example, ``{"deadline": 5}``.
        """
        future = self.delete_async(**options)
        if not _transaction.in_transaction():
            return future.result()
Exemplo n.º 2
0
 def test_true(in_context):
     with in_context.new(transaction=b"tx123").use():
         assert _transaction.in_transaction() is True
Exemplo n.º 3
0
 def test_false():
     assert _transaction.in_transaction() is False