def METHOD_NAME(new_categories):
    class Slave(Fmi2Slave):
        log_categories = new_categories
        def do_step(self, t, dt):
            return True
    slave = Slave(instance_name="instance")
    xml = slave.to_xml()
    categories = xml.find("LogCategories")
    if len(new_categories) > 0:
        assert len(categories) == len(Slave.log_categories)
        for category, description in Slave.log_categories.items():
            assert categories.find(f"Category[@name='{category}'][@description='{description}']") is not None
    else:
        assert categories is None