(self)
| 309 | assert X.evals == 1 |
| 310 | |
| 311 | def test_callbacks(self): |
| 312 | source = Mock(name='source') |
| 313 | p = PromiseProxy(source) |
| 314 | cbA = Mock(name='cbA') |
| 315 | cbB = Mock(name='cbB') |
| 316 | cbC = Mock(name='cbC') |
| 317 | p.__then__(cbA, p) |
| 318 | p.__then__(cbB, p) |
| 319 | assert not p.__evaluated__() |
| 320 | assert object.__getattribute__(p, '__pending__') |
| 321 | |
| 322 | assert repr(p) |
| 323 | assert p.__evaluated__() |
| 324 | with pytest.raises(AttributeError): |
| 325 | object.__getattribute__(p, '__pending__') |
| 326 | cbA.assert_called_with(p) |
| 327 | cbB.assert_called_with(p) |
| 328 | |
| 329 | assert p.__evaluated__() |
| 330 | p.__then__(cbC, p) |
| 331 | cbC.assert_called_with(p) |
| 332 | |
| 333 | with pytest.raises(AttributeError): |
| 334 | object.__getattribute__(p, '__pending__') |
| 335 | |
| 336 | def test_maybe_evaluate(self): |
| 337 | x = PromiseProxy(lambda: 30) |
nothing calls this directly
no test coverage detected