def METHOD_NAME(self):
    # sanity check if the given object is a set
    observer = create_observer(optional=False)
    with self.assertRaises(ValueError) as exception_context:
        list(observer.iter_objects(None))
    self.assertIn(
        "Expected a TraitSet to be observed, got",
        str(exception_context.exception),
    )