code: def test_directory_initpy(self) -> None:
      doc = Document()
      results = {}
  
      def load(filename: str):
          handler = bahd.DirectoryHandler(filename=filename)
          handler.modify_document(doc)
          # this will get called by the server but we have to fake it here
          handler.on_server_loaded("server_context")
          results["package"] = (
              handler._package is not None
              and handler._package_runner is not None
              and handler._package_runner.ran
          )
          if handler.failed:
              raise RuntimeError(handler.error)
  
      with_directory_contents(
          {
              "main.py": "from . import foo\n"
              + script_adds_two_roots(
                  "SomeModelInTestDirectory",
                  "AnotherModelInTestDirectory",
              ),
              "__init__.py": "",
              "foo.py": " # this script does nothing",
          },
          load,
      )
  
      assert len(doc.roots) == 2
      assert results["package"] is True
  
imports: from __future__ import annotations
  import pytest
  from typing import TYPE_CHECKING
  import jinja2
  from bokeh.core.templates import FILE
  from bokeh.document import Document
  from tests.support.util.filesystem import with_directory_contents
  import bokeh.application.handlers.directory
label_desc: Use image node_id 2 for calling the Test_DirectoryHandler obj's underlying member method code with example usage: obj.test_directory_initpy() without return types