code: def test_pipeline_discard(self, r):
      # empty pipeline should raise an error
      with r.pipeline() as pipe:
          pipe.set("key", "someval")
          pipe.discard()
          with pytest.raises(redis.exceptions.ResponseError):
              pipe.execute()
  
      # setting a pipeline and discarding should do the same
      with r.pipeline() as pipe:
          pipe.set("key", "someval")
          pipe.set("someotherkey", "val")
          response = pipe.execute()
          pipe.set("key", "another value!")
          pipe.discard()
          pipe.set("key", "another vae!")
          with pytest.raises(redis.exceptions.ResponseError):
              pipe.execute()
  
          pipe.set("foo", "bar")
          response = pipe.execute()
      assert response[0]
      assert r.get("foo") == b"bar"
  
imports: from contextlib import closing
  from unittest import mock
  import pytest
  import redis
  from .conftest import skip_if_server_version_lt, wait_for_command
label_desc: Use image node_id 27 for calling the TestPipeline obj's underlying member method code with example usage: obj.test_pipeline_discard(r) without return types