code: def test_get_pubsub_keys(self, r):
      commands_parser = CommandsParser(r)
      args1 = ["PUBLISH", "foo", "bar"]
      args2 = ["PUBSUB NUMSUB", "foo1", "foo2", "foo3"]
      args3 = ["PUBSUB channels", "*"]
      args4 = ["SUBSCRIBE", "foo1", "foo2", "foo3"]
      assert commands_parser.get_keys(r, *args1) == ["foo"]
      assert commands_parser.get_keys(r, *args2) == [
          "foo1",
          "foo2",
          "foo3",
      ]
      assert commands_parser.get_keys(r, *args3) == ["*"]
      assert commands_parser.get_keys(r, *args4) == [
          "foo1",
          "foo2",
          "foo3",
      ]
  
file_path: redis-py/tests/test_command_parser.py
imports: import pytest
  from redis._parsers import CommandsParser
  from .conftest import assert_resp_response, skip_if_redis_enterprise, skip_if_server_version_lt
label_desc: Use image node_id 5 for calling the TestCommandsParser obj's underlying member method code with example usage: obj.test_get_pubsub_keys(r) without return types