Mercurial > pytave
changeset 290:f2b4576879a6
Edit tests in subsref to use and verify cell indexing
* @pyobject/subsref.m: Edit an existing test to use the available cell indexing
syntax and also add a test to verify that None is returned if nargout > 0
author | Abhinav Tripathi <genuinelucifer@gmail.com> |
---|---|
date | Wed, 03 Aug 2016 00:26:44 -0700 |
parents | 49832ca978fd |
children | a0dc81daf553 |
files | @pyobject/subsref.m |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/@pyobject/subsref.m Wed Aug 03 00:22:20 2016 -0700 +++ b/@pyobject/subsref.m Wed Aug 03 00:26:44 2016 -0700 @@ -119,11 +119,11 @@ %! assert (L{1}, 10) %! assert (L{2}, 20) -%!xtest +%!test %! % list indexing, slice %! pyexec ("L = [10, 20, [30, 40]]") %! L = pyobject.fromPythonVarName ("L"); -%! L2 = L{:}; +%! [L2{1:length(L)}] = L{:}; %! assert (L2{1}, 10) %! assert (L2{2}, 20) %! assert (L2{3}{1}, 30) @@ -242,6 +242,12 @@ %! f (); %! assert (length (ans) == 3) +%!test +%! % ensure None is returned if nargout > 0 +%! L = pyeval ("[1, None, 3]"); +%! a = L{2}; +%! assert (char (a), "None") + %!error <outputs must match> %! % multiple return values: too many outputs %! f = pyeval ("lambda: (1, 2)");