code: def test_load_schema_optional_types_are_not_optional_fields(
      self,
  ) -> None:
      with self.assertRaisesRegex(TypeError, "my_optional_str"):
          self.mapper.map_with_type(
              {
                  "my_bool": True,
                  "my_int": -2,
                  "my_float": 3.14,
                  "my_str": "bar",
                  "my_enum": "ham",
                  "my_list": ["spam", "ham"],
                  "my_dict": {"eggs": 6},
              },
              SampleConfigTypes,
          )
  
imports: from enum import Enum
  from typing import ClassVar, Dict, List, Optional, Union
  from unittest import main, TestCase
  import attr
  from torchbiggraph.schema import Dumper, extract_nested_type, inject_nested_value, Loader, Schema, schema, unpack_optional
label_desc: Use image node_id 9 for calling the TestLoader obj's underlying member method code with example usage: obj.test_load_schema_optional_types_are_not_optional_fields() without return types