def test_instanceSlots(self):
        """
        Test that when rebuilding an instance with a __slots__ attribute, it
        fails accurately instead of giving a L{rebuild.RebuildError}.
        """
        classDefinition = (
            "class NotSlottedClass(object):\n"
            "    pass\n")

        exec(classDefinition, self.m.__dict__)
        inst = self.m.NotSlottedClass()
        inst.__slots__ = ['a']
        classDefinition = (
            "class NotSlottedClass:\n"
            "    pass\n")
        exec(classDefinition, self.m.__dict__)
        # Moving from new-style class to old-style should fail.
        self.assertRaises(TypeError, rebuild.updateInstance, inst)

        Test that when rebuilding an instance with a __slots__ attribute, it
        fails accurately instead of giving a L{rebuild.RebuildError}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_rebuild.py