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

Method test_half_float

Lib/test/test_memoryview.py:630–636  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

628 self.assertEqual(d.value, 0.6)
629
630 def test_half_float(self):
631 half_data = struct.pack('eee', 0.0, -1.5, 1.5)
632 float_data = struct.pack('fff', 0.0, -1.5, 1.5)
633 half_view = memoryview(half_data).cast('e')
634 float_view = memoryview(float_data).cast('f')
635 self.assertEqual(half_view.nbytes * 2, float_view.nbytes)
636 self.assertListEqual(half_view.tolist(), float_view.tolist())
637
638 def test_memoryview_hex(self):
639 # Issue #9951: memoryview.hex() segfaults with non-contiguous buffers.

Callers

nothing calls this directly

Calls 5

assertListEqualMethod · 0.80
packMethod · 0.45
castMethod · 0.45
assertEqualMethod · 0.45
tolistMethod · 0.45

Tested by

no test coverage detected