def METHOD_NAME(self):
    code = dedent("""\
        def func():
            yield 1
    """)
    self.mod1.write(code)
    with self.assertRaises(exceptions.RefactoringError):
        UseFunction(self.project, self.mod1, code.index("func"))