MCPcopy Create free account
hub / github.com/cdgriffith/Box / _IndexOnce

Class _IndexOnce

test/test_box_list.py:672–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670
671
672class _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"])

Calls

no outgoing calls