class_docstr: Adds subTest() context manager to the TestCase if supported.
  
  Note: To use this feature, make sure you call super() in setUpClass to
  initialize the sub stack.
docstr: Same as assertAllEqual but compatible with nested dict.
  
  Args:
    d1: First element to compare
    d2: Second element to compare
    atol: If given, perform a close float comparison. Otherwise, perform an
      exact comparison
docstr_tok: ["Same","as","assertAllEqual","but","compatible","with","nested","dict",".","Args",":","d1",":","First","element","to","compare","d2",":","Second","element","to","compare","atol",":","If","given",",","perform","a","close","float","comparison",".","Otherwise",",","perform","an","exact","comparison"]
code: def assertAllEqualNested(
      self, d1, d2, *, atol: Optional[float] = None
  ):
      """Same as assertAllEqual but compatible with nested dict.
  
      Args:
        d1: First element to compare
        d2: Second element to compare
        atol: If given, perform a close float comparison. Otherwise, perform an
          exact comparison
      """
      if isinstance(d1, dict):
          # assertAllEqual do not works well with dictionaries so assert
          # on each individual elements instead
          zipped_examples = utils.zip_nested(d1, d2, dict_only=True)
          utils.map_nested(
              # recursively call assertAllEqualNested in case there is a dataset.
              lambda x: self.assertAllEqualNested(
                  x[0], x[1], atol=atol
              ),
              zipped_examples,
              dict_only=True,
          )
      elif isinstance(
          d1,
          (
              tf.data.Dataset,
              dataset_utils._IterableDataset,  # pylint: disable=protected-access
              python.PythonDataSource,
              list,
          ),
      ):
          # Checks length and elements of the dataset. At the moment, more than one
          # level of nested datasets is not supported.
          self.assertEqual(len(d1), len(d2))
          for ex1, ex2 in zip(iter(d1), iter(d2)):
              self.assertAllEqualNested(ex1, ex2, atol=atol)
      elif atol:
          self.assertAllClose(d1, d2, atol=atol)
      else:
          self.assertAllEqual(d1, d2)
  
imports: import contextlib
  import dataclasses
  import functools
  from typing import Any, Optional, Type
  import dill
  from etils import enp
  import numpy
  from tensorflow_datasets.core import dataset_utils
  from tensorflow_datasets.core import features
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.data_sources import python
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.utils import tree_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  from tensorflow_datasets.testing import test_case
  from tensorflow_datasets.testing import test_utils
label_desc: Use image node_id 3 for calling the SubTestCase obj's underlying member method code with example usage: obj.assertAllEqualNested(d1, d2) without return types