MCPcopy Index your code
hub / github.com/RustPython/RustPython / randitems

Function randitems

Lib/test/test_buffer.py:211–222  ·  view source on GitHub ↗

Return random format, items, item.

(n, obj='ndarray', mode=None, char=None)

Source from the content-addressed store, hash-verified

209 return fmt, items, item
210
211def randitems(n, obj='ndarray', mode=None, char=None):
212 """Return random format, items, item."""
213 if mode is None:
214 mode = choice(cap[obj][MODE])
215 if char is None:
216 char = choice(tuple(fmtdict[mode]))
217 multiplier = choice(cap[obj][MULT])
218 fmt = mode + '#' + char * int(multiplier if multiplier else 1)
219 items = gen_items(n, fmt, obj)
220 item = gen_item(fmt, obj)
221 fmt = mode.strip('amb') + multiplier + char
222 return fmt, items, item
223
224def iter_mode(n, obj='ndarray'):
225 """Iterate through supported mode/char combinations."""

Calls 3

gen_itemsFunction · 0.85
gen_itemFunction · 0.85
stripMethod · 0.45

Tested by

no test coverage detected