code: def test_custom_chat_template(
      self,
      chat_messages,
      mock_check_valid_model,
      mock_auto_tokenizer,
      mock_text_generation,
  ):
      custom_chat_template = "Here goes some Jinja template"
  
      # mocked method to check if we called apply_chat_template with the custom template
      mock_auto_tokenizer.apply_chat_template = MagicMock(
          return_value="some_value"
      )
  
      generator = HuggingFaceTGIChatGenerator(
          chat_template=custom_chat_template
      )
      generator.warm_up()
  
      assert generator.chat_template == custom_chat_template
  
      generator.run(messages=chat_messages)
      assert mock_auto_tokenizer.apply_chat_template.call_count == 1
  
      # and we indeed called apply_chat_template with the custom template
      _, kwargs = mock_auto_tokenizer.apply_chat_template.call_args
      assert kwargs["chat_template"] == custom_chat_template
  
imports: from unittest.mock import patch, MagicMock, Mock
  import pytest
  from huggingface_hub.inference._text_generation import TextGenerationStreamResponse, Token, StreamDetails, FinishReason
  from huggingface_hub.utils import RepositoryNotFoundError
  from haystack.components.generators.chat import HuggingFaceTGIChatGenerator
  from haystack.dataclasses import StreamingChunk, ChatMessage
label_desc: Use image node_id 6 for calling the TestHuggingFaceTGIChatGenerator obj's underlying member method code with example usage: obj.test_custom_chat_template(chat_messages, mock_check_valid_model, mock_auto_tokenizer, mock_text_generation) without return types