code: def test_class_namespaces_are_registered() -> None:
      # confirm that existing (and new) namespaces
      # have been added to that class's "_accessors" attr
      for pcls in (pl.Expr, pl.DataFrame, pl.LazyFrame, pl.Series):
          namespaces: set[str] = getattr(pcls, "_accessors", set())
          for name in dir(pcls):
              if not name.startswith("_"):
                  attr = getattr(pcls, name)
                  if isinstance(attr, property):
                      try:
                          obj = attr.fget(pcls)  # type: ignore[misc]
                      except Exception:
                          continue
  
                      if obj.__class__.__name__.endswith("NameSpace"):
                          ns = obj._accessor
                          assert (
                              ns in namespaces
                          ), f"{ns!r} should be registered in {pcls.__name__}._accessors"
  
file_path: polars/py-polars/tests/unit/test_api.py
imports: from __future__ import annotations
  import pytest
  import polars
  from polars.testing import assert_frame_equal
label_desc: Use image node_id 5 for calling a global function with example usage: test_class_namespaces_are_registered() without return types