MCPcopy Create free account
hub / github.com/ml-explore/mlx / test_format

Method test_format

python/tests/test_array.py:2181–2192  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2179 int(a)
2180
2181 def test_format(self):
2182 a = mx.arange(3)
2183 self.assertEqual(f"{a[0]:.2f}", "0.00")
2184
2185 b = mx.array(0.35487)
2186 self.assertEqual(f"{b:.1f}", "0.4")
2187
2188 with self.assertRaises(TypeError):
2189 s = f"{a:.2f}"
2190
2191 a = mx.array([1, 2, 3])
2192 self.assertEqual(f"{a}", "array([1, 2, 3], dtype=int32)")
2193
2194 def test_deep_graphs(self):
2195 # The following tests should simply run cleanly without a segfault or

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.60

Tested by

no test coverage detected