def test_relative_nested_flatten(self):
        """Tests nested structure is flattened to export dir. Will require
        rename of duplicate asset file names and change of relative asset path
        in fo3d file.
        """
        with tempfile.TemporaryDirectory() as temp_dir:
            dataset = self._build_nested_relative(temp_dir)

            # Export it and flatten (no rel_dir)
            export_dir = os.path.join(temp_dir, "export")
            dataset.export(
                export_dir=export_dir,
                dataset_type=fo.types.MediaDirectory,
                export_media=True,
            )

            # Flattening should mean duplicate file names gain a '-2'
            fileset = set(os.listdir(export_dir))
            self.assertSetEqual(
                fileset,
                {
                    "image.jpeg",
                    "pcd.pcd",
                    "obj.obj",
                    "mtl.mtl",
                    "s.fo3d",
                    "image.jpeg",
                    "pcd-2.pcd",
                    "obj-2.obj",
                    "mtl-2.mtl",
                    "s-2.fo3d",
                },
            )

            # Scene 1
            scene1_2 = fo.Scene.from_fo3d(os.path.join(export_dir, "s.fo3d"))
            self.assertSetEqual(
                set(scene1_2.get_asset_paths()),
                {
                    "image.jpeg",
                    "pcd.pcd",
                    "obj.obj",
                    "mtl.mtl",
                },
            )
            # Scene 2
            scene2_2 = fo.Scene.from_fo3d(os.path.join(export_dir, "s-2.fo3d"))
            self.assertSetEqual(
                set(scene2_2.get_asset_paths()),
                {
                    "image.jpeg",
                    "pcd-2.pcd",
                    "obj-2.obj",
                    "mtl-2.mtl",
                },
            )

            # Make sure we align on scene number from before - remember, scene2
            #   has a red background! Swap if necessary
            if scene1_2.background.color == "red":
                scene2_2, scene1_2 = scene1_2, scene2_2

            for file in scene1_2.get_asset_paths():
                with open(os.path.join(export_dir, file)) as f:
                    self.assertEqual(f.read(), os.path.basename(file))

            for file in scene2_2.get_asset_paths():
                if file.endswith("image.jpeg"):
                    continue
                with open(os.path.join(export_dir, file)) as f:
                    self.assertEqual(
                        f.read(),
                        os.path.basename(file).replace("-2", "") + "2",
                    )
Tests nested structure is flattened to export dir. Will require
        rename of duplicate asset file names and change of relative asset path
        in fo3d file.
        
tests/unittests/import_export_tests.py