def test_call(self): lazy = _LazyError( ValueError("lazy failure")) # creating doesn't cause error with self.assertRaisesMessage(ValueError, "lazy failure"): self.unused = lazy() # call *does* cause error
def test_attr(self): lazy = _LazyError( ValueError("lazy failure")) # creating doesn't cause error lazy.some_prop = "foo" # setattr doesn't cause error with self.assertRaisesMessage(ValueError, "lazy failure"): self.unused = lazy.anything # getattr *does* cause error