예제 #1
0
 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
예제 #2
0
 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