def METHOD_NAME(self):
    # the keys for the splitter prefs (i.e. prefs['h_split']['structure'])
    splitter_keys = ("h_split", "structure")
    def _get_nattr(obj, attr_names=splitter_keys):
        """Utility function to get a value from a nested dict."""
        if obj is None or len(attr_names) == 0:
            return obj
        return _get_nattr(
            obj.get(attr_names[0], None), attr_names=attr_names[1:]
        )
    with create_ui(TmpClass()) as ui:
        handler = ui.handler
        # set the layout to a known state
        handler.reset_prefs(ui.info)
        # save the current layout and check (sanity test)
        handler.save_prefs(ui.info)
        self.assertEqual(
            _get_nattr(handler._prefs), _get_nattr(ui.get_prefs())
        )
        # collapse splitter to right and check prefs has been updated
        handler.collapse_right(ui.info)
        self.assertNotEqual(
            _get_nattr(handler._prefs), _get_nattr(ui.get_prefs())
        )
        # restore the original layout.
        handler.restore_prefs(ui.info)
        self.assertEqual(
            _get_nattr(handler._prefs), _get_nattr(ui.get_prefs())
        )
        # collapse to left and check
        handler.collapse_left(ui.info)
        self.assertNotEqual(
            _get_nattr(handler._prefs), _get_nattr(ui.get_prefs())
        )
        # save the collapsed layout
        handler.save_prefs(ui.info)
        collapsed_splitter_state = _get_nattr(handler._prefs)
        self.assertEqual(
            _get_nattr(handler._prefs), _get_nattr(ui.get_prefs())
        )
    # create a new ui and check that the splitter remembers the last state
    # (collapsed)
    with create_ui(TmpClass()) as ui2:
        self.assertEqual(
            collapsed_splitter_state, _get_nattr(ui2.get_prefs())
        )