| 709 | |
| 710 | |
| 711 | class _IndexOnce: |
| 712 | def __init__(self, value): |
| 713 | self.value = value |
| 714 | self.calls = 0 |
| 715 | |
| 716 | def __index__(self): |
| 717 | self.calls += 1 |
| 718 | if self.calls > 1: |
| 719 | raise AssertionError("index was evaluated more than once") |
| 720 | return self.value |
| 721 | |
| 722 | |
| 723 | @pytest.mark.parametrize("operation", ["insert", "pop", "delete"]) |
no outgoing calls