From 3cf0c34406bfb905167f04bc3d4607175b98c334 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 8 Jun 2016 16:06:29 -0600 Subject: [PATCH 01/13] Uncomment tests involving conversion of complex_float32 to bool. --- dynd/nd/test/test_array_basics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dynd/nd/test/test_array_basics.py b/dynd/nd/test/test_array_basics.py index 1d4de48b..1a1c5ed7 100644 --- a/dynd/nd/test/test_array_basics.py +++ b/dynd/nd/test/test_array_basics.py @@ -47,9 +47,9 @@ def test_nonzero(self): self.assertTrue(bool(nd.array(100.0, type=ndt.float32))) self.assertTrue(bool(nd.array(100.0, type=ndt.float64))) # complex values -# self.assertFalse(bool(nd.array(0.0, type=ndt.complex_float32))) ##### FIX ME + self.assertFalse(bool(nd.array(0.0, type=ndt.complex_float32))) self.assertFalse(bool(nd.array(0.0, type=ndt.complex_float64))) -# self.assertTrue(bool(nd.array(100.0+10.0j, type=ndt.complex_float32))) ###### FIX ME + self.assertTrue(bool(nd.array(100.0+10.0j, type=ndt.complex_float32))) self.assertTrue(bool(nd.array(100.0+10.0j, type=ndt.complex_float64))) # strings self.assertFalse(bool(nd.array(''))) From ff4ff80e296ddfa072453568c9e1599194f6a6bd Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 8 Jun 2016 16:07:15 -0600 Subject: [PATCH 02/13] Uncomment nested struct test. --- dynd/nd/test/test_array_construct.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/dynd/nd/test/test_array_construct.py b/dynd/nd/test/test_array_construct.py index d9ffc389..b31abf1c 100644 --- a/dynd/nd/test/test_array_construct.py +++ b/dynd/nd/test/test_array_construct.py @@ -277,15 +277,12 @@ def test_single_struct(self): self.assertEqual(nd.as_py(a[2]), True) def test_nested_struct(self): - """ - # FIX ME a = nd.array([[1,2], ['test', 3.5], [3j]], type='{x: 2 * int16, y: {a: string, b: float64}, z: 1 * complex[float32]}') self.assertEqual(nd.as_py(a.x), [1, 2]) self.assertEqual(nd.as_py(a.y.a), 'test') self.assertEqual(nd.as_py(a.y.b), 3.5) self.assertEqual(nd.as_py(a.z), [3j]) - """ a = nd.array({'x':[1,2], 'y':{'a':'test', 'b':3.5}, 'z':[3j]}, type='{x: 2 * int16, y: {a: string, b: float64}, z: 1 * complex[float64]}') From 75d1b46278f24cc9c26efa7fa1c470e054a173dd Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 8 Jun 2016 16:20:47 -0600 Subject: [PATCH 03/13] Uncomment uint value limits test. --- dynd/nd/test/test_array_basics.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/dynd/nd/test/test_array_basics.py b/dynd/nd/test/test_array_basics.py index 1a1c5ed7..2627a2cd 100644 --- a/dynd/nd/test/test_array_basics.py +++ b/dynd/nd/test/test_array_basics.py @@ -113,7 +113,6 @@ def test_contiguous(self): self.assertFalse(nd.is_c_contiguous(a)) self.assertFalse(nd.is_f_contiguous(a)) - """ def test_uint_value_limits(self): # Valid maximums a = nd.array(0xff, type = ndt.uint8) @@ -129,7 +128,6 @@ def test_uint_value_limits(self): self.assertRaises(OverflowError, nd.array, 0x10000, type = ndt.uint16) self.assertRaises(OverflowError, nd.array, 0x100000000, type = ndt.uint32) self.assertRaises(OverflowError, nd.array, 0x10000000000000000, type = ndt.uint64) - """ def test_inf(self): # Validate nd.inf From a0f61fdfa19c94d262b4987ed3a6d9dbfc6c4ff9 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 8 Jun 2016 16:55:28 -0600 Subject: [PATCH 04/13] Uncomment some dimension deduction tests. --- dynd/nd/test/test_array_construct.py | 32 ++++++++++++---------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/dynd/nd/test/test_array_construct.py b/dynd/nd/test/test_array_construct.py index b31abf1c..e0ade746 100644 --- a/dynd/nd/test/test_array_construct.py +++ b/dynd/nd/test/test_array_construct.py @@ -619,53 +619,50 @@ def test_extra_field(self): # self.assertEqual(nd.type_of(a), ndt.type('var * int32')) # self.assertEqual(nd.as_py(a), [2*x + 1 for x in range(7)]) -""" class TestDeduceDims(unittest.TestCase): + """ def test_simplearr(self): val = [[[1, 2], [3, 4]], [[5, 6], [7, 8]], [[11, 12], [13, 14]], [[15, 16], [17, 18]]] # Deduce all the dims - a = nd.array(val, dtype=ndt.int16) + a = nd.array(val, type=ndt.int16) self.assertEqual(nd.type_of(a), ndt.type('4 * 2 * 2 * int16')) self.assertEqual(nd.as_py(a), val) # Specify some dims as fixed - a = nd.array(val, dtype='Fixed * int16') + a = nd.array(val, type='Fixed * int16') self.assertEqual(nd.type_of(a), ndt.type('4 * 2 * 2 * int16')) self.assertEqual(nd.as_py(a), val) - a = nd.array(val, dtype='Fixed * Fixed * int16') + a = nd.array(val, type='Fixed * Fixed * int16') self.assertEqual(nd.type_of(a), ndt.type('4 * 2 * 2 * int16')) self.assertEqual(nd.as_py(a), val) - a = nd.array(val, dtype='Fixed * Fixed * Fixed * int16') + a = nd.array(val, type='Fixed * Fixed * Fixed * int16') self.assertEqual(nd.type_of(a), ndt.type('4 * 2 * 2 * int16')) self.assertEqual(nd.as_py(a), val) # Specify some dims as fixed - a = nd.array(val, dtype='2 * int16') + a = nd.array(val, type='2 * int16') self.assertEqual(nd.type_of(a), ndt.type('4 * 2 * 2 * int16')) self.assertEqual(nd.as_py(a), val) - a = nd.array(val, dtype='2 * 2 * int16') + a = nd.array(val, type='2 * 2 * int16') self.assertEqual(nd.type_of(a), ndt.type('4 * 2 * 2 * int16')) self.assertEqual(nd.as_py(a), val) - a = nd.array(val, dtype='4 * 2 * 2 * int16') + a = nd.array(val, type='4 * 2 * 2 * int16') self.assertEqual(nd.type_of(a), ndt.type('4 * 2 * 2 * int16')) self.assertEqual(nd.as_py(a), val) # Mix fixed, symbolic fixed, and var - a = nd.array(val, dtype='4 * var * Fixed * int16') + a = nd.array(val, type='4 * var * Fixed * int16') self.assertEqual(nd.type_of(a), ndt.type('4 * var * 2 * int16')) self.assertEqual(nd.as_py(a), val) - a = nd.array(val, dtype='var * 2 * int16') + a = nd.array(val, type='var * 2 * int16') self.assertEqual(nd.type_of(a), ndt.type('4 * var * 2 * int16')) self.assertEqual(nd.as_py(a), val) - a = nd.array(val, dtype='Fixed * 2 * int16') + a = nd.array(val, type='Fixed * 2 * int16') self.assertEqual(nd.type_of(a), ndt.type('4 * 2 * 2 * int16')) self.assertEqual(nd.as_py(a), val) + """ def test_empty(self): - # A fixed dimension of non-zero size gets pushed down - a = nd.array([], dtype='3 * int32') - self.assertEqual(nd.type_of(a), ndt.type('0 * 3 * int32')) - self.assertEqual(nd.as_py(a), []) # A fixed dimension of zero size gets absorbed - a = nd.array([], dtype='0 * int32') + a = nd.array([], type='0 * int32') self.assertEqual(nd.type_of(a), ndt.type('0 * int32')) self.assertEqual(nd.as_py(a), []) # A symbolic fixed dimension gets absorbed @@ -674,10 +671,9 @@ def test_empty(self): # self.assertEqual(nd.type_of(a), ndt.type('0 * int32')) # self.assertEqual(nd.as_py(a), []) # A var dimension gets absorbed - a = nd.array([], dtype='var * int32') + a = nd.array([], type='var * int32') self.assertEqual(nd.type_of(a), ndt.type('var * int32')) self.assertEqual(nd.as_py(a), []) -""" #class TestConstructErrors(unittest.TestCase): # def test_bad_params(self): From d87894ee19f5a4a61ee38e7ecb1373898ccdc7d5 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 8 Jun 2016 17:15:26 -0600 Subject: [PATCH 05/13] Uncomment some tests checking for proper error handling when constructing arrays. --- dynd/nd/test/test_array_construct.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dynd/nd/test/test_array_construct.py b/dynd/nd/test/test_array_construct.py index e0ade746..76501195 100644 --- a/dynd/nd/test/test_array_construct.py +++ b/dynd/nd/test/test_array_construct.py @@ -675,18 +675,18 @@ def test_empty(self): self.assertEqual(nd.type_of(a), ndt.type('var * int32')) self.assertEqual(nd.as_py(a), []) -#class TestConstructErrors(unittest.TestCase): -# def test_bad_params(self): -# self.assertRaises(ValueError, nd.array, type='int32') -# self.assertRaises(ValueError, nd.array, type='2 * 2 * int32') -# self.assertRaises(ValueError, nd.array, access='readwrite') - -# def test_dict_auto_detect(self): -# # Trigger failure in initial auto detect pass -# self.assertRaises(ValueError, nd.array, {'x' : 1}) -# self.assertRaises(ValueError, nd.array, [{'x' : 1}]) -# # Trigger failure in later type promotion -# self.assertRaises(ValueError, nd.array, [['a'], {'x' : 1}]) +class TestConstructErrors(unittest.TestCase): + def test_bad_params(self): + self.assertRaises(TypeError, nd.array, type='int32') + self.assertRaises(TypeError, nd.array, type='2 * 2 * int32') + + def test_dict_auto_detect(self): + # Trigger failure in initial auto detect pass + self.assertRaises(ValueError, nd.array, {'x' : 1}) + self.assertRaises(ValueError, nd.array, [{'x' : 1}]) + # Trigger failure in later type promotion + # TODO: fix + # self.assertRaises(ValueError, nd.array, [['a'], {'x' : 1}]) class TestOptionArrayConstruct(unittest.TestCase): def check_scalars(self, type, input_expected): From 64894b67f6eec2413c12291c88cf437798e73c66 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 8 Jun 2016 17:30:39 -0600 Subject: [PATCH 06/13] Uncomment some of the tests for converting option types to and from python objects. --- dynd/nd/test/test_array_construct.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/dynd/nd/test/test_array_construct.py b/dynd/nd/test/test_array_construct.py index 76501195..82d3cbdb 100644 --- a/dynd/nd/test/test_array_construct.py +++ b/dynd/nd/test/test_array_construct.py @@ -697,11 +697,11 @@ def check_scalars(self, type, input_expected): self.assertEqual(nd.as_py(a), expected) def test_scalar_option(self): -# self.check_scalars('?bool', [(None, None), -# ('', None), -# ('NA', None), -# (False, False), -# ('true', True)]) + self.check_scalars('?bool', [(None, None), + #('', None), + #('NA', None), + (False, False), + ('true', True)]) self.check_scalars('?int', [(None, None), ('', None), ('NA', None), (-10, -10), ('12354', 12354)]) self.check_scalars('?real', [(None, None), ('', None), @@ -710,10 +710,11 @@ def test_scalar_option(self): ('12354', 12354), (1.25, 1.25), ('125e20', 125e20)]) -# self.check_scalars('?string', [(None, None), -# ('', ''), -# ('NA', 'NA'), -# (u'\uc548\ub155', u'\uc548\ub155')]) + #self.check_scalars('?string', [(None, None), + # ('', ''), + # ('NA', 'NA'), + # (u'\uc548\ub155', u'\uc548\ub155') + # ]) if __name__ == '__main__': unittest.main(verbosity=2) From 3f5209b20c01f60e5ee62802047fb61e0de6a2b8 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 8 Jun 2016 17:41:23 -0600 Subject: [PATCH 07/13] Uncomment test for broadcasting cast. --- dynd/nd/test/test_array_cast.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dynd/nd/test/test_array_cast.py b/dynd/nd/test/test_array_cast.py index 5b739d5e..24bc867a 100644 --- a/dynd/nd/test/test_array_cast.py +++ b/dynd/nd/test/test_array_cast.py @@ -4,10 +4,10 @@ from dynd import nd, ndt class TestNDObjectCast(unittest.TestCase): -# def test_broadcast_cast(self): -# a = nd.array(10) -# b = a.cast('3 * int32') -# self.assertEqual(nd.as_py(b), [10, 10, 10]) + def test_broadcast_cast(self): + a = nd.array(10) + b = a.cast('3 * int32') + self.assertEqual(nd.as_py(b), [10, 10, 10]) def test_strided_to_fixed(self): a = nd.array([5,1,2]) From c4bceaf10e4a7000fa4c4f1d8917981b8f579e77 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 8 Jun 2016 23:23:41 -0600 Subject: [PATCH 08/13] Uncomment part of a test checking proper output for symbolic types. --- dynd/nd/test/test_array_dtype.py | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/dynd/nd/test/test_array_dtype.py b/dynd/nd/test/test_array_dtype.py index 8abcb71d..846a1955 100644 --- a/dynd/nd/test/test_array_dtype.py +++ b/dynd/nd/test/test_array_dtype.py @@ -27,25 +27,25 @@ def test_type_type(self): self.assertEqual(nd.type_of(n), d) self.assertEqual(nd.as_py(n), ndt.float64) - #def test_symbolic_type(self): - # tp = ndt.type('(int, real) -> complex') - # self.assertEqual(tp.type_id, 'callable') - # self.assertEqual(nd.as_py(tp.pos_types), [ndt.int32, ndt.float64]) - # self.assertEqual(tp.return_type, ndt.complex_float64) - # tp = ndt.type('MyType') - # self.assertEqual(tp.type_id, 'typevar') - # self.assertEqual(tp.name, 'MyType') - # tp = ndt.type('MyDim * int') - # self.assertEqual(tp.type_id, 'typevar_dim') - # self.assertEqual(tp.name, 'MyDim') - # self.assertEqual(tp.element_type, ndt.int32) - # tp = ndt.type('... * int') - # self.assertEqual(tp.type_id, 'ellipsis_dim') - # self.assertEqual(tp.element_type, ndt.int32) - # tp = ndt.type('MyEll... * int') - # self.assertEqual(tp.type_id, 'ellipsis_dim') - # self.assertEqual(tp.name, 'MyEll') - # self.assertEqual(tp.element_type, ndt.int32) + def test_symbolic_type(self): + tp = ndt.type('(int, real) -> complex') + self.assertTrue(ndt.type('Callable').match(tp)) + self.assertEqual(tp.pos_types, [ndt.int32, ndt.float64]) + self.assertEqual(tp.return_type, ndt.complex_float64) + #tp = ndt.type('MyType') + #self.assertEqual(tp.type_id, 'typevar') + #self.assertEqual(tp.name, 'MyType') + #tp = ndt.type('MyDim * int') + #self.assertEqual(tp.type_id, 'typevar_dim') + #self.assertEqual(tp.name, 'MyDim') + #self.assertEqual(tp.element_type, ndt.int32) + #tp = ndt.type('... * int') + #self.assertEqual(tp.type_id, 'ellipsis_dim') + #self.assertEqual(tp.element_type, ndt.int32) + #tp = ndt.type('MyEll... * int') + #self.assertEqual(tp.type_id, 'ellipsis_dim') + #self.assertEqual(tp.name, 'MyEll') + #self.assertEqual(tp.element_type, ndt.int32) """ ToDo: Fix this. From e51fc54c6ecc5eb3de758c1894fa0847c572d3d8 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 8 Jun 2016 23:56:30 -0600 Subject: [PATCH 09/13] Re-enable test involving assigning to a struct. --- dynd/nd/test/test_array_setitem.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dynd/nd/test/test_array_setitem.py b/dynd/nd/test/test_array_setitem.py index daf86e42..4a910eed 100644 --- a/dynd/nd/test/test_array_setitem.py +++ b/dynd/nd/test/test_array_setitem.py @@ -1,5 +1,6 @@ import sys import unittest +from collections import OrderedDict as odict from dynd import nd, ndt @unittest.skip('Test disabled since callables were reworked') @@ -27,20 +28,24 @@ def test_strided_dim(self): # a[4] = 101.0 + 0j # self.assertEqual(nd.as_py(a[4]), 101) - """ - Todo: Fix this test when structs can assign to named tuples. - + # Todo: Add to this test when structs can assign to named tuples. def test_assign_to_struct(self): value = [(8, u'world', 4.5), (16, u'!', 8.75)] # Assign list of tuples a = nd.empty('2 * { i : int32, msg : string, price : float64 }') a[:] = value - self.assertEqual(nd.as_py(a), value) + keys = ['i', 'msg', 'price'] + out_val = [{key:val for key, val in zip(keys, val_row)} + for val_row in value] + self.assertEqual(nd.as_py(a), out_val) # Assign iterator of tuples a = nd.empty('2 * { i : int32, msg : string, price : float64 }') a[:] = iter(value) - self.assertEqual(nd.as_py(a, tuple=True), value) - """ + self.assertEqual(nd.as_py(a), out_val) + # Assign a list of OrderedDicts + a = nd.empty('2 * { i : int32, msg : string, price : float64 }') + a[:] = odict([zip(keys, vals) for vals in value]) + self.assertEqual(nd.as_py(a), out_val) if __name__ == '__main__': unittest.main(verbosity=2) From 5e9b5061854a15662e1fd4e56bb3f28c9ac01b06 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Thu, 9 Jun 2016 00:06:59 -0600 Subject: [PATCH 10/13] Uncomment and add to test for assigning to tuples. --- dynd/nd/test/test_array_setitem.py | 37 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/dynd/nd/test/test_array_setitem.py b/dynd/nd/test/test_array_setitem.py index 4a910eed..371d03f9 100644 --- a/dynd/nd/test/test_array_setitem.py +++ b/dynd/nd/test/test_array_setitem.py @@ -1,9 +1,8 @@ import sys import unittest -from collections import OrderedDict as odict +from collections import OrderedDict as odict, namedtuple as ntuple from dynd import nd, ndt -@unittest.skip('Test disabled since callables were reworked') class TestArraySetItem(unittest.TestCase): def test_strided_dim(self): @@ -11,24 +10,24 @@ def test_strided_dim(self): a[...] = nd.range(100) a[0] = 1000 self.assertEqual(nd.as_py(a[0]), 1000) - a[1:8:3] = 120 - self.assertEqual(nd.as_py(a[:11]), - [1000, 120, 2, 3, 120, 5, 6, 120, 8, 9, 10]) - a[5:2:-1] = [-10, -20, -30] - self.assertEqual(nd.as_py(a[:11]), - [1000, 120, 2, -30, -20, -10, 6, 120, 8, 9, 10]) - a[1] = False - self.assertEqual(nd.as_py(a[1]), 0) - a[2] = True - self.assertEqual(nd.as_py(a[2]), 1) - a[3] = -10.0 - self.assertEqual(nd.as_py(a[3]), -10) + # Next line causes a crash. + #a[1:8:3] = 120 + #self.assertEqual(nd.as_py(a[:11]), + # [1000, 120, 2, 3, 120, 5, 6, 120, 8, 9, 10]) + #a[5:2:-1] = [-10, -20, -30] + #self.assertEqual(nd.as_py(a[:11]), + # [1000, 120, 2, -30, -20, -10, 6, 120, 8, 9, 10]) + #a[1] = False + #self.assertEqual(nd.as_py(a[1]), 0) + #a[2] = True + #self.assertEqual(nd.as_py(a[2]), 1) + #a[3] = -10.0 + #self.assertEqual(nd.as_py(a[3]), -10) # Should the following even be supported? # a[4] = 101.0 + 0j # self.assertEqual(nd.as_py(a[4]), 101) - # Todo: Add to this test when structs can assign to named tuples. def test_assign_to_struct(self): value = [(8, u'world', 4.5), (16, u'!', 8.75)] # Assign list of tuples @@ -44,7 +43,13 @@ def test_assign_to_struct(self): self.assertEqual(nd.as_py(a), out_val) # Assign a list of OrderedDicts a = nd.empty('2 * { i : int32, msg : string, price : float64 }') - a[:] = odict([zip(keys, vals) for vals in value]) + a[:] = [odict(zip(keys, vals)) for vals in value] + self.assertEqual(nd.as_py(a), out_val) + # Assign a list of namedtuples + named_class = ntuple('named_class', ['i', 'msg', 'price']) + nt_vals = [named_class(*item) for item in value] + a = nd.empty('2 * { i : int32, msg : string, price : float64 }') + a[:] = nt_vals self.assertEqual(nd.as_py(a), out_val) if __name__ == '__main__': From 3d6cf3a9fadf3e98a92bfad848489c3488bc51a0 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 22 Jun 2016 17:31:36 -0600 Subject: [PATCH 11/13] Uncomment additional test for nd.squeeze. --- dynd/nd/test/test_array_squeeze.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dynd/nd/test/test_array_squeeze.py b/dynd/nd/test/test_array_squeeze.py index 90b044e1..3a8e46f5 100644 --- a/dynd/nd/test/test_array_squeeze.py +++ b/dynd/nd/test/test_array_squeeze.py @@ -18,9 +18,6 @@ def test_squeeze_strided(self): self.assertEqual(a.shape, (3, 1)) self.assertEqual(nd.squeeze(a).shape, (3,)) - """ - ToDo: Fix this. - def test_squeeze_var(self): # Simple var case (squeeze can see into leading size-1 var dims) a = nd.array([[[1], [2,3]]], type='var * var * var * int32') @@ -32,7 +29,6 @@ def test_squeeze_var(self): self.assertEqual(a.shape, (1, 2, -1, 1)) self.assertEqual(nd.squeeze(a).shape, (2, -1)) self.assertEqual(nd.as_py(nd.squeeze(a)), [[1], [2,3]]) - """ def test_squeeze_axis(self): a = nd.zeros(1, 3, 1, 2, 1, ndt.int32) From 7458a90a3a5a1bfe63f86a5154519e175277e315 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 22 Jun 2016 18:02:18 -0600 Subject: [PATCH 12/13] Uncommented an old arrfunc test. Renamed test_arrfunc to test_callable. --- dynd/nd/test/{test_arrfunc.py => test_callable.py} | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) rename dynd/nd/test/{test_arrfunc.py => test_callable.py} (96%) diff --git a/dynd/nd/test/test_arrfunc.py b/dynd/nd/test/test_callable.py similarity index 96% rename from dynd/nd/test/test_arrfunc.py rename to dynd/nd/test/test_callable.py index 83ee07e5..9a858021 100644 --- a/dynd/nd/test/test_arrfunc.py +++ b/dynd/nd/test/test_callable.py @@ -13,21 +13,14 @@ else: c_ssize_t = ctypes.c_int64 -class TestArrFunc(unittest.TestCase): +class TestCallable(unittest.TestCase): pass - """ def test_creation(self): af = nd.empty('(float32) -> int32') - self.assertEqual(nd.type_of(af).type_id, 'arrfunc') + self.assertTrue(ndt.type('Callable').match(nd.type_of(af))) # Test there is a string version of a NULL arrfunc self.assertTrue(str(af) != '') - # Test there is a string version of an initialized arrfunc - af = _lowlevel.make_arrfunc_from_assignment( - ndt.float32, ndt.int64, "nocheck") - self.assertTrue(str(af) != '') - self.assertEqual(nd.type_of(af), ndt.type("(int64) -> float32")) - """ # def test_arrfunc_constructor(self): # af = nd.apply(lambda x, y : [x, y], '(int, int) -> {x:int, y:int}') From 95703b8bcf8d3d85b828183ee1d4b8a3647619f8 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Wed, 22 Jun 2016 22:43:08 -0600 Subject: [PATCH 13/13] Comment out callable test that causes segfaults on Unix systems. --- dynd/nd/test/test_callable.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dynd/nd/test/test_callable.py b/dynd/nd/test/test_callable.py index 9a858021..51ebc61d 100644 --- a/dynd/nd/test/test_callable.py +++ b/dynd/nd/test/test_callable.py @@ -16,11 +16,13 @@ class TestCallable(unittest.TestCase): pass + """ def test_creation(self): af = nd.empty('(float32) -> int32') self.assertTrue(ndt.type('Callable').match(nd.type_of(af))) # Test there is a string version of a NULL arrfunc self.assertTrue(str(af) != '') + """ # def test_arrfunc_constructor(self): # af = nd.apply(lambda x, y : [x, y], '(int, int) -> {x:int, y:int}')