code: def test_dict_type():
      spec = {
          "number": float,
          "nested": {
              "list_str": [str],
          },
      }
      exact = {
          "number": 1,
          "nested": {
              "list_str": ["hello", "world"],
          },
      }
      subset = {"nested": {"list_str": ["hi"]}}
      narrow = {"number": 1, "string": "hi"}
  
      wb_type = TypeRegistry.type_of(exact)
      assert wb_type.assign(exact) == wb_type
      assert wb_type.assign(subset) == InvalidType()
      assert wb_type.assign(narrow) == InvalidType()
  
      spec = {
          "optional_number": OptionalType(float),
          "optional_unknown": OptionalType(UnknownType()),
      }
  
      wb_type = TypedDictType(spec)
      assert wb_type.assign({}) == wb_type
      assert wb_type.assign({"optional_number": 1}) == wb_type
      assert wb_type.assign({"optional_number": "1"}) == InvalidType()
      assert wb_type.assign(
          {"optional_unknown": "hi"}
      ) == TypedDictType(
          {
              "optional_number": OptionalType(float),
              "optional_unknown": OptionalType(str),
          }
      )
      assert wb_type.assign(
          {"optional_unknown": None}
      ) == TypedDictType(
          {
              "optional_number": OptionalType(float),
              "optional_unknown": OptionalType(UnknownType()),
          }
      )
  
      wb_type = TypedDictType({"unknown": UnknownType()})
      assert wb_type.assign({}) == InvalidType()
      assert wb_type.assign({"unknown": None}) == InvalidType()
      assert wb_type.assign({"unknown": 1}) == TypedDictType(
          {"unknown": float},
      )
  
imports: import datetime
  import numpy
  import pytest
  import wandb
  from wandb import data_types
  from wandb.sdk.data_types._dtypes import AnyType, BooleanType, ConstType, InvalidType, ListType, NoneType, NumberType, OptionalType, StringType, TimestampType, TypedDictType, TypeRegistry, UnionType, UnknownType
label_desc: Use image node_id 14 for calling a global function with example usage: test_dict_type() without return types