()
| 465 | |
| 466 | |
| 467 | def test_proxy_context_manager(): |
| 468 | class Example: |
| 469 | value = 2 |
| 470 | |
| 471 | def __enter__(self): |
| 472 | self.value += 1 |
| 473 | return self |
| 474 | |
| 475 | def __exit__(self, exc_type, exc_val, exc_tb): |
| 476 | self.value -= 1 |
| 477 | |
| 478 | _, p = _make_proxy(Example()) |
| 479 | assert p.value == 2 |
| 480 | |
| 481 | with p: |
| 482 | assert p.value == 3 |
| 483 | |
| 484 | assert p.value == 2 |
| 485 | |
| 486 | |
| 487 | def test_proxy_class(): |
nothing calls this directly
no test coverage detected