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

Method test_obj_inequality_array

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

Source from the content-addressed store, hash-verified

215 self.assertTrue(a != c)
216
217 def test_obj_inequality_array(self):
218 str_ = "hello"
219 a = mx.array([1, 2, 3])
220 lst_ = [1, 2, 3]
221 tpl_ = (1, 2, 3)
222
223 # check if object comparison(</>/<=/>=) with mlx array should throw an exception
224 # if not, the tests will fail
225 with self.assertRaises(ValueError):
226 a < str_
227 with self.assertRaises(ValueError):
228 a > str_
229 with self.assertRaises(ValueError):
230 a <= str_
231 with self.assertRaises(ValueError):
232 a >= str_
233 with self.assertRaises(ValueError):
234 a < lst_
235 with self.assertRaises(ValueError):
236 a > lst_
237 with self.assertRaises(ValueError):
238 a <= lst_
239 with self.assertRaises(ValueError):
240 a >= lst_
241 with self.assertRaises(ValueError):
242 a < tpl_
243 with self.assertRaises(ValueError):
244 a > tpl_
245 with self.assertRaises(ValueError):
246 a <= tpl_
247 with self.assertRaises(ValueError):
248 a >= tpl_
249
250 def test_invalid_op_on_array(self):
251 str_ = "hello"

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.60

Tested by

no test coverage detected