code: def test_atypical_nesting_replace(self):
      def build(a, b):
          return FakeAtypicalNestingResults(
              unique_atypical_nesting=a,
              atypical_inner_results=FakeResults(b),
          )
  
      results = build(0, 1)
      self.assertEqual(
          unnest.replace_innermost(results, unique_atypical_nesting=2),
          build(2, 1),
      )
      self.assertEqual(
          unnest.replace_innermost(results, unique_core=2), build(0, 2)
      )
      self.assertEqual(
          unnest.replace_innermost(
              results, unique_atypical_nesting=2, unique_core=3
          ),
          build(2, 3),
      )
      self.assertEqual(
          unnest.replace_innermost(
              results,
              return_unused=True,
              unique_atypical_nesting=2,
              unique_core=3,
              foo=4,
          ),
          (build(2, 3), {"foo": 4}),
      )
      self.assertEqual(
          unnest.replace_outermost(results, unique_atypical_nesting=2),
          build(2, 1),
      )
      self.assertEqual(
          unnest.replace_outermost(results, unique_core=2), build(0, 2)
      )
      self.assertEqual(
          unnest.replace_outermost(
              results, unique_atypical_nesting=2, unique_core=3
          ),
          build(2, 3),
      )
      self.assertEqual(
          unnest.replace_outermost(
              results,
              return_unused=True,
              unique_atypical_nesting=2,
              unique_core=3,
              foo=4,
          ),
          (build(2, 3), {"foo": 4}),
      )
      self.assertRaises(
          ValueError,
          lambda: unnest.replace_innermost(  # pylint: disable=g-long-lambda
              results, unique_core=1, foo=1
          ),
      )
      self.assertRaises(
          ValueError,
          lambda: unnest.replace_outermost(  # pylint: disable=g-long-lambda
              results, unique_core=1, foo=1
          ),
      )
  
imports: import collections
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import unnest
label_desc: Use image node_id 7 for calling the TestNestedAccessors obj's underlying member method code with example usage: obj.test_atypical_nesting_replace() and returns: FakeAtypicalNestingResults