Refactor TestOrder
@@ -53,16 +53,23 @@ class TestSize(unittest.TestCase):
return xp.size(a)
+_orders = {
+ order_arg: order_expect
+ for order_expect, order_args in [
+ ('C', ['C', 'c', 'CONTIGUOUS', '', None]),
+ ('F', ['F', 'f', 'FORTRAN']),
+ ]
+ for order_arg in order_args
+}
+
+
class TestOrder(unittest.TestCase):
- @testing.for_orders([
- 'C', 'c', 'CONTIGUOUS',
- 'F', 'f', 'FORTRAN',
- None,
- ])
+ @testing.for_orders(_orders.keys())
def test_ndarray(self, order):
+ order_expect = _orders[order]
a = core.ndarray((2, 3), order=order)
- expect_c = order is None or order[0].upper() == 'C'
- expect_f = order is not None and order[0].upper() == 'F'
+ expect_c = order_expect == 'C'
+ expect_f = order_expect == 'F'
assert a.flags.c_contiguous == expect_c
assert a.flags.f_contiguous == expect_f
