code: def test_collapse_nested(self):
      inner1 = UniformNdMapping({1: Dataset([(1, 2)], ["x", "y"])}, "Y")
      inner2 = UniformNdMapping({1: Dataset([(3, 4)], ["x", "y"])}, "Y")
      outer = UniformNdMapping({1: inner1, 2: inner2}, "X")
      collapsed = outer.collapse()
      expected = Dataset(
          [(1, 1, 1, 2), (2, 1, 3, 4)], ["X", "Y", "x", "y"]
      )
      self.assertEqual(collapsed, expected)
  
imports: import numpy
  from holoviews import Dataset, HoloMap
  from holoviews.core import Dimension
  from holoviews.core.ndmapping import MultiDimensionalMapping, NdMapping, UniformNdMapping
  from holoviews.core.overlay import Overlay
  from holoviews.element import Curve
  from holoviews.element.comparison import ComparisonTestCase
label_desc: Use image node_id 1 for calling the UniformNdMappingTest obj's underlying member method code with example usage: obj.test_collapse_nested() without return types