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

Method test_length_hint

Lib/test/test_struct.py:895–908  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

893 self.assertRaises(StopIteration, next, it)
894
895 def test_length_hint(self):
896 lh = operator.length_hint
897 s = struct.Struct('>IB')
898 b = bytes(range(1, 16))
899 it = s.iter_unpack(b)
900 self.assertEqual(lh(it), 3)
901 next(it)
902 self.assertEqual(lh(it), 2)
903 next(it)
904 self.assertEqual(lh(it), 1)
905 next(it)
906 self.assertEqual(lh(it), 0)
907 self.assertRaises(StopIteration, next, it)
908 self.assertEqual(lh(it), 0)
909
910 def test_module_func(self):
911 # Sanity check for the global struct.iter_unpack()

Callers

nothing calls this directly

Calls 4

nextFunction · 0.85
iter_unpackMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected