code: def test_session_multiple_new_sessions(self, sentinel):
      s = sentinel(0)
  
      def handle_to_dict(msg):
          s.set(s.get() + 1)
  
          message = json.loads(msg)
  
          assert message["data"] == {
              "a": [1, 2, 3, 1, 2, 3],
              "b": ["a", "b", "c", "str1", "str2", "str3"],
          }
  
      manager = PerspectiveManager()
      sessions = [manager.new_session() for i in range(5)]
      table = Table(data)
  
      manager.host_table("table1", table)
  
      # create a view on each session
      for i, session in enumerate(sessions):
          # IDs have to conflict - each viewer will send the first message as
          # ID = 1, so we need to make sure we handle that.
          msg = {
              "id": 1,
              "table_name": "table1",
              "view_name": "view" + str(i),
              "cmd": "view",
          }
          session.process(msg, self.post)
  
      manager_views = list(manager._views.keys())
      for key in ["view" + str(i) for i in range(5)]:
          assert key in manager_views
  
      for i, session in enumerate(sessions):
          view = manager._get_view("view" + str(i))
          assert view._client_id == session.client_id
  
      # arbitrarily do an update
      random_session_id = random.randint(0, 4)
      update_message = {
          "id": 2,
          "name": "table1",
          "cmd": "table_method",
          "method": "update",
          "args": [{"a": [1, 2, 3], "b": ["str1", "str2", "str3"]}],
      }
      sessions[random_session_id].process(update_message, self.post)
  
      # should reflect in all sessions
      for i, session in enumerate(sessions):
          to_dict_message = {
              "id": 3,
              "name": "view" + str(i),
              "cmd": "view_method",
              "method": "to_dict",
          }
          session.process(to_dict_message, handle_to_dict)
  
      assert s.get() == 5
  
file_path: perspective/python/perspective/perspective/tests/manager/test_session.py
imports: import json
  import random
  from perspective import Table, PerspectiveManager
label_desc: Use image node_id 4 for calling the TestPerspectiveSession obj's underlying member method code with example usage: obj.test_session_multiple_new_sessions(sentinel) without return types