MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / IndexableNoLen

Class IndexableNoLen

tests/test_cmd2.py:1812–1816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1810 # Test that an object with __getitem__ but no __len__ works.
1811 # This covers the except (IndexError, TypeError) block in select()
1812 class IndexableNoLen:
1813 def __getitem__(self, item: int) -> str:
1814 if item == 0:
1815 return "value"
1816 raise IndexError
1817
1818 # Mock read_input to return '1'
1819 read_input_mock = mock.MagicMock(name="read_input", return_value="1")

Callers 1

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…