code: def test_attrs_match_forbidden_props(component_class):
      assert (
          "_.*" in reserved_words
      ), "props cannot have leading underscores"
  
      # props are not added as attrs unless explicitly provided
      # except for children, which is always set if it's a prop at all.
      expected_attrs = set(reserved_words + ["children"]) - {"_.*"}
      c = component_class()
      base_attrs = set(dir(c))
      extra_attrs = set(a for a in base_attrs if a[0] != "_")
  
      assert (
          extra_attrs == expected_attrs
      ), "component has only underscored and reserved word attrs"
  
      # setting props causes them to show up as attrs
      c2 = component_class("children", id="c2", optionalArray=[1])
      prop_attrs = set(dir(c2))
  
      assert base_attrs - prop_attrs == set([]), "no attrs were removed"
      assert prop_attrs - base_attrs == {
          "id",
          "optionalArray",
      }, "explicit props were added as attrs"
  
imports: import json
  import os
  from collections import OrderedDict
  from difflib import unified_diff
  import pytest
  from dash.development._py_components_generation import generate_class
  from dash.development.component_generator import reserved_words
  from .None import _dir, expected_table_component_doc
label_desc: Use image node_id 13 for calling a global function with example usage: test_attrs_match_forbidden_props(component_class) without return types