@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': (rec.test_name + '_{}'.format(dtype)), 'rng_factory': rec.rng_factory, 'op_name': rec.name, 'dtype': dtype} for rec in JAX_OPERATOR_OVERLOADS if (rec.nargs == 2) for dtype in rec.dtypes)))
def testBinaryOperatorDefers(self, op_name, rng_factory, dtype):
    rng = rng_factory()
    arg = jax.device_put(rng((), dtype))
    op = getattr(operator, op_name)
    other = _OverrideEverything()
    assert (op(other, arg) is other)
    assert (op(arg, other) is other)
    other = _OverrideNothing()
    if (op_name == '__eq__'):
        assert (op(other, arg) is False)
        assert (op(arg, other) is False)
    elif (op_name == '__ne__'):
        assert (op(other, arg) is True)
        assert (op(arg, other) is True)
    else:
        with self.assertRaises(TypeError):
            op(other, arg)
        with self.assertRaises(TypeError):
            op(arg, other)
@parameterized.named_parameters(jtu.cases_from_list(({'testcase_name': (rec.test_name + '_{}'.format(dtype)), 'rng_factory': rec.rng_factory, 'op_name': rec.name, 'dtype': dtype} for rec in JAX_OPERATOR_OVERLOADS if (rec.nargs == 2) for dtype in rec.dtypes)))
def testBinaryOperatorDefers(self, op_name, rng_factory, dtype):
    rng = rng_factory()
    arg = jax.device_put(rng((), dtype))
    op = getattr(operator, op_name)
    other = _OverrideEverything()
    assert (op(other, arg) is other)
    assert (op(arg, other) is other)
    other = _OverrideNothing()
    if (op_name == '__eq__'):
        assert (op(other, arg) is False)
        assert (op(arg, other) is False)
    elif (op_name == '__ne__'):
        assert (op(other, arg) is True)
        assert (op(arg, other) is True)
    else:
        with self.assertRaises(TypeError):
            op(other, arg)
        with self.assertRaises(TypeError):
            op(arg, other)