code: def test_recompute(self) -> None:
      d = Document()
      dm = d.models
      assert len(dm) == 0
  
      r1 = Row(children=[Div(name="dr1")])
      r2 = Row(children=[Div(name="dr2"), Div(name="dr2")])
  
      d.add_root(r1)
      d.add_root(r2)
  
      assert set(dm._models_by_name._dict) == {"dr1", "dr2"}
  
      for m in dm:
          assert m._document is d
  
      d.remove_root(r1)
      for m in dm:
          assert m._document is d
  
      assert r1._document is None
      assert r1.children[0]._document is None
  
      assert set(dm._models_by_name._dict) == {"dr2"}
  
imports: from __future__ import annotations
  import pytest
  import gc
  from unittest.mock import MagicMock, patch
  from bokeh.core.has_props import Local
  from bokeh.core.properties import Instance, Nullable
  from bokeh.core.types import ID
  from bokeh.document import Document
  from bokeh.model import Model
  from bokeh.models import Div, Row
  import bokeh.document.models
label_desc: Use image node_id 12 for calling the TestDocumentModelManager obj's underlying member method code with example usage: obj.test_recompute() without return types