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

Class _IndexOnce

test/test_box_list.py:711–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709
710
711class _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"])

Calls

no outgoing calls