Unittest __init__ exception handling

How do you test for an exception that needs to occur in the __init__ of a ray actor class? I’m using unittest.

I tried

with self.assertRaises(TypeError):

But it gives a ValueError: 'object_refs' must either be an ObjectRef or a list of ObjectRefs.. Meanwhile, trying to trigger some random method with ray.get(r.dummy_method.remote()) just hangs.

I could do it using this script

import ray

class A:
    def __init__(self):
        raise ValueError

a = A.remote()

Thanks, but I’m specifically looking for catching this in a unit test. Is there a way to do that?