| 670 | |
| 671 | |
| 672 | class _IndexOnce: |
| 673 | def __init__(self, value): |
| 674 | self.value = value |
| 675 | self.calls = 0 |
| 676 | |
| 677 | def __index__(self): |
| 678 | self.calls += 1 |
| 679 | if self.calls > 1: |
| 680 | raise AssertionError("index was evaluated more than once") |
| 681 | return self.value |
| 682 | |
| 683 | |
| 684 | @pytest.mark.parametrize("operation", ["insert", "pop", "delete"]) |
no outgoing calls