code: def check_widget(w, **d):
      """Check a single widget against a dict"""
      for attr, expected in d.items():
          if attr == "cls":
              assert w.__class__ is expected
          else:
              value = getattr(w, attr)
              assert value == expected, "{}.{} = {!r} != {!r}".format(
                  w.__class__.__name__, attr, value, expected
              )
  
              # For numeric values, the types should match too
              if isinstance(value, (int, float)):
                  tv = type(value)
                  te = type(expected)
                  assert tv is te, "type({}.{}) = {!r} != {!r}".format(
                      w.__class__.__name__, attr, tv, te
                  )
  
imports: from unittest.mock import patch
  import os
  from collections import OrderedDict
  import pytest
  import ipywidgets
  from traitlets import TraitError, Float
  from ipywidgets import interact, interact_manual, interactive, interaction, Output, Widget
  from .utils import setup, teardown
label_desc: Use image node_id 4 for calling a global function with example usage: check_widget(w) without return types