code: def test_router_serialization_idempotence(self):
      routes = [
          {
              "condition": "{{streams|length < 2}}",
              "output": "{{message}}",
              "output_type": ChatMessage,
              "output_name": "message",
          },
          {
              "condition": "{{streams|length >= 2}}",
              "output": "{{streams}}",
              "output_type": List[int],
              "output_name": "streams",
          },
      ]
      router = ConditionalRouter(routes)
      # invoke to_dict twice and check that the result is the same
      router_dict_first_invocation = copy.deepcopy(router.to_dict())
      router_dict_second_invocation = router.to_dict()
      assert (
          router_dict_first_invocation == router_dict_second_invocation
      )
  
imports: import copy
  from typing import List
  from unittest import mock
  import pytest
  from haystack.components.routers import ConditionalRouter
  from haystack.components.routers.conditional_router import NoRouteSelectedException
  from haystack.dataclasses import ChatMessage
label_desc: Use image node_id 16 for calling the TestRouter obj's underlying member method code with example usage: obj.test_router_serialization_idempotence() without return types