Mercurial > pytave
diff @pyobject/pyobject.m @ 400:6c316b5f30f7
Convert empty 1-D or 2-D arrays to Python array.array (fixes issue #69)
* oct-py-types.cc (pytave::make_py_array): Also convert arrays with zero columns
or zero rows.
* octave_to_python.cc (pytave::octvalue_to_pyobj): Convert numeric arrays with
zero columns or zero rows with make_py_array.
* @pyobject/pyobject.m: Add %!tests.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Fri, 28 Apr 2017 10:34:18 -0700 |
parents | d362cdd1ddeb |
children | f833e29b2c12 |
line wrap: on
line diff
--- a/@pyobject/pyobject.m Fri Apr 28 10:13:04 2017 -0700 +++ b/@pyobject/pyobject.m Fri Apr 28 10:34:18 2017 -0700 @@ -382,7 +382,9 @@ %!assert (isa (pyobject ("a string"), "py.str")) %!assert (isa (pyobject (struct ()), "py.dict")) %!assert (isa (pyobject (cell ()), "py.tuple")) +%!assert (isa (pyobject ([]), "py.array.array")) %!assert (isa (pyobject ([1, 2, 3, 4]), "py.array.array")) +%!assert (isa (pyobject ([1; 2; 3; 4]), "py.array.array")) %!assert (all (isa (pyobject (0), {"pyobject", "py.float", "py.numbers.Number"}))) ## Test conversion method pyobject.int64