code: def test_base_optional_subclass_required(self):
      @kw_only_dataclasses.dataclass
      class Parent:
          a: int = kw_only_dataclasses.field(default=2, kw_only=True)
  
      @kw_only_dataclasses.dataclass
      class Child(Parent):
          b: int
  
      child_params = inspect.signature(Child.__init__).parameters
      self.assertEqual(list(child_params), ["self", "b", "a"])
      self.assertEqual(child_params["a"].default, 2)
      self.assertEqual(
          child_params["b"].default, inspect.Parameter.empty
      )
  
      v1 = Child(4)
      self.assertDictEqual(dataclasses.asdict(v1), dict(a=2, b=4))
  
      v2 = Child(4, a=5)  # pylint: disable=too-many-function-args
      self.assertDictEqual(dataclasses.asdict(v2), dict(a=5, b=4))
  
file_path: flax/tests/linen/kw_only_dataclasses_test.py
imports: import dataclasses
  import inspect
  from absl.testing import absltest
  from flax.linen import kw_only_dataclasses
label_desc: Use image node_id 2 for calling the KwOnlyDataclassesTest obj's underlying member method code with example usage: obj.test_base_optional_subclass_required() without return types