From 584c462046b5937dad4fab1072fed3bc0a890796 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Tue, 20 Sep 2016 19:33:15 -0500 Subject: [PATCH 1/2] Move dynamic propagation of registry into Python namespaces out of the main dynd namespace. This is primarily a stopgap to get the CI tests working again before moving this registration code into the type portion of dynd-python. --- dynd/__init__.py | 4 ---- dynd/nd/__init__.py | 8 ++++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dynd/__init__.py b/dynd/__init__.py index 78b838d3..b765673b 100644 --- a/dynd/__init__.py +++ b/dynd/__init__.py @@ -19,7 +19,3 @@ '__libdynd_version__', '__version__', '__libdynd_git_sha1__', '__git_sha1__', 'annotate', 'test', 'load' ] - -from .nd.registry import propagate_all - -propagate_all() diff --git a/dynd/nd/__init__.py b/dynd/nd/__init__.py index 1cbfb93e..b3a5b34c 100644 --- a/dynd/nd/__init__.py +++ b/dynd/nd/__init__.py @@ -12,7 +12,11 @@ parse_json, squeeze, dtype_of, old_linspace, fields, ndim_of from .callable import callable +from . import functional + +from .registry import propagate_all + +propagate_all() + inf = float('inf') nan = float('nan') - -from . import functional From 5bcab7d88bbc411075440d0316044e23490376be Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Tue, 20 Sep 2016 20:08:39 -0500 Subject: [PATCH 2/2] Move callable type tests into dynd.nd instead of dynd.ndt. --- dynd/nd/test/test_callable_type.py | 11 +++++++++++ dynd/{ndt => nd}/test/test_type_basics.py | 3 ++- dynd/ndt/test/test_dtype.py | 6 ------ 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 dynd/nd/test/test_callable_type.py rename dynd/{ndt => nd}/test/test_type_basics.py (86%) diff --git a/dynd/nd/test/test_callable_type.py b/dynd/nd/test/test_callable_type.py new file mode 100644 index 00000000..aa58a98a --- /dev/null +++ b/dynd/nd/test/test_callable_type.py @@ -0,0 +1,11 @@ +import unittest +# import nd to ensure that the callable type is registered at all. +from dynd import nd, ndt + +class TestCallableType(unittest.TestCase): + + def test_callable(self): + tp = ndt.callable(ndt.void, ndt.int32, ndt.float64, x = ndt.complex128) + + def test_callable_type(self): + tp = ndt.callable(ndt.int32, ndt.float64) diff --git a/dynd/ndt/test/test_type_basics.py b/dynd/nd/test/test_type_basics.py similarity index 86% rename from dynd/ndt/test/test_type_basics.py rename to dynd/nd/test/test_type_basics.py index 5dc90c52..0b077579 100644 --- a/dynd/ndt/test/test_type_basics.py +++ b/dynd/nd/test/test_type_basics.py @@ -1,5 +1,6 @@ import unittest -from dynd import ndt +# import nd to make sure the types are propagated out of the registry. +from dynd import ndt, nd class TestTypeBasics(unittest.TestCase): def test_type_repr(self): diff --git a/dynd/ndt/test/test_dtype.py b/dynd/ndt/test/test_dtype.py index 1ecdb847..29c67343 100644 --- a/dynd/ndt/test/test_dtype.py +++ b/dynd/ndt/test/test_dtype.py @@ -10,9 +10,6 @@ def test_tuple(self): def test_struct(self): tp = ndt.struct(x = ndt.int32, y = ndt.float64) - def test_callable(self): - tp = ndt.callable(ndt.void, ndt.int32, ndt.float64, x = ndt.complex128) - class TestTypeFor(unittest.TestCase): def test_bool(self): self.assertEqual(ndt.bool, ndt.type_for(True)) @@ -182,9 +179,6 @@ def test_fixed_bytes_type(self): def test_cstruct_type(self): self.assertFalse(ndt.type('{x: int32}') == ndt.type('{y: int32}')) - def test_callable_type(self): - tp = ndt.callable(ndt.int32, ndt.float64) - def test_struct_type(self): tp = ndt.make_struct([ndt.int32, ndt.int64], ['x', 'y']) self.assertTrue(tp.field_types, [ndt.int32, ndt.int64])