From 071448dca6406ef972f811461fd9156b2a468a88 Mon Sep 17 00:00:00 2001 From: latot Date: Thu, 26 Jan 2017 12:22:10 -0300 Subject: [PATCH] fix tests --- inst/@sym/contains.m | 2 +- inst/@sym/imageset.m | 8 ++++---- inst/@sym/iscomplement.m | 4 ++-- inst/@sym/isdisjoint.m | 2 +- inst/@sym/isemptyset.m | 2 +- inst/@sym/isintersection.m | 2 +- inst/@sym/isleftunbounded.m | 4 ++-- inst/@sym/ispropersubset.m | 2 +- inst/@sym/ispropersuperset.m | 2 +- inst/@sym/isrightunbounded.m | 4 ++-- inst/@sym/issubset.m | 2 +- inst/@sym/issuperset.m | 2 +- inst/@sym/isuniversalset.m | 2 +- inst/@sym/point.m | 2 +- inst/@sym/psets.m | 16 ++++++---------- inst/@sym/rangeset.m | 12 ++++++------ 16 files changed, 32 insertions(+), 36 deletions(-) diff --git a/inst/@sym/contains.m b/inst/@sym/contains.m index b015f403e..50837d07e 100644 --- a/inst/@sym/contains.m +++ b/inst/@sym/contains.m @@ -26,7 +26,7 @@ %% @group %% a = interval (sym (0), 10); %% contains (5, a) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/imageset.m b/inst/@sym/imageset.m index 921acf309..2351623c6 100644 --- a/inst/@sym/imageset.m +++ b/inst/@sym/imageset.m @@ -43,10 +43,10 @@ %% syms y %% f = x^exp(y); %% imageset (f, [x y], domain ('Naturals0')) -%% @result{} ans = (sym) -%% ⎧ ⎛ y⎞ ⎫ -%% ⎨ ⎝ℯ ⎠ ⎬ -%% ⎩x | x, y ∊ ℕ₀⎭ +%% @result{} ans = (sym 1×2 matrix) +%% ⎡⎧ ⎛ y⎞ ⎫ ⎧ ⎛ y⎞ ⎫⎤ +%% ⎢⎨ ⎝ℯ ⎠ ⎬ ⎨ ⎝ℯ ⎠ ⎬⎥ +%% ⎣⎩x | x ∊ ℕ₀⎭ ⎩x | y ∊ ℕ₀⎭⎦ %% @end group %% @end example %% diff --git a/inst/@sym/iscomplement.m b/inst/@sym/iscomplement.m index bd680ca9b..cd65e0c7b 100644 --- a/inst/@sym/iscomplement.m +++ b/inst/@sym/iscomplement.m @@ -27,7 +27,7 @@ %% a = domain ('Reals'); %% b = domain ('Complexes'); %% iscomplement (b - a) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% @@ -45,4 +45,4 @@ %!test %! a = domain ('Reals'); %! b = domain ('Integers'); -%! assert (iscomplement (a - b)) +%! assert (logical (iscomplement (a - b))) diff --git a/inst/@sym/isdisjoint.m b/inst/@sym/isdisjoint.m index 05f2463bb..a5a711dae 100644 --- a/inst/@sym/isdisjoint.m +++ b/inst/@sym/isdisjoint.m @@ -27,7 +27,7 @@ %% a = interval (sym (0), 10); %% b = interval (sym (11), 15); %% isdisjoint (a, b) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/isemptyset.m b/inst/@sym/isemptyset.m index 76b8c88da..55509d463 100644 --- a/inst/@sym/isemptyset.m +++ b/inst/@sym/isemptyset.m @@ -25,7 +25,7 @@ %% @example %% @group %% isemptyset (domain ('EmptySet')) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/isintersection.m b/inst/@sym/isintersection.m index 61cdfce6f..f08b012d4 100644 --- a/inst/@sym/isintersection.m +++ b/inst/@sym/isintersection.m @@ -28,7 +28,7 @@ %% a = interval (x, 1); %% b = interval (sym (-1), 3); %% isintersection (intersect (a, b)) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/isleftunbounded.m b/inst/@sym/isleftunbounded.m index 231b51a0f..444ba6274 100644 --- a/inst/@sym/isleftunbounded.m +++ b/inst/@sym/isleftunbounded.m @@ -26,7 +26,7 @@ %% @group %% a = interval (sym (-inf), 0); %% isleftunbounded (a) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% @@ -34,7 +34,7 @@ %% @group %% a = interval (sym (0), inf); %% isleftunbounded (a) -%% @result{} ans = 0 +%% @result{} ans = (sym) False %% @end group %% @end example %% diff --git a/inst/@sym/ispropersubset.m b/inst/@sym/ispropersubset.m index bbf7b6445..a1a3c1938 100644 --- a/inst/@sym/ispropersubset.m +++ b/inst/@sym/ispropersubset.m @@ -27,7 +27,7 @@ %% a = interval (sym (0), sym (1)/2); %% b = interval(sym (0), 1); %% ispropersubset (a, b) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/ispropersuperset.m b/inst/@sym/ispropersuperset.m index b4ffea372..c01b84035 100644 --- a/inst/@sym/ispropersuperset.m +++ b/inst/@sym/ispropersuperset.m @@ -27,7 +27,7 @@ %% a = interval (sym (0), 1); %% b = interval (sym (0), sym (1)/2); %% ispropersuperset (a, b) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/isrightunbounded.m b/inst/@sym/isrightunbounded.m index d03ee847d..dd56c6593 100644 --- a/inst/@sym/isrightunbounded.m +++ b/inst/@sym/isrightunbounded.m @@ -26,14 +26,14 @@ %% @group %% a = interval (0, sym (inf)); %% isrightunbounded (a) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% %% @group %% a = interval (-inf, sym (0)); %% isrightunbounded (a) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/issubset.m b/inst/@sym/issubset.m index 4964db987..5b9230d7b 100644 --- a/inst/@sym/issubset.m +++ b/inst/@sym/issubset.m @@ -27,7 +27,7 @@ %% a = interval (sym (0), sym (1)/2); %% b = interval (sym (0), 1); %% issubset (a, b) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/issuperset.m b/inst/@sym/issuperset.m index c2eb54e6c..4530d92da 100644 --- a/inst/@sym/issuperset.m +++ b/inst/@sym/issuperset.m @@ -27,7 +27,7 @@ %% a = interval (sym (0), 1); %% b = interval (sym (0), 1, true); %% issuperset (a, b) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/isuniversalset.m b/inst/@sym/isuniversalset.m index 8714778cb..908b7dd64 100644 --- a/inst/@sym/isuniversalset.m +++ b/inst/@sym/isuniversalset.m @@ -25,7 +25,7 @@ %% @example %% @group %% isuniversalset (domain ('UniversalSet')) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/point.m b/inst/@sym/point.m index 71ff9befd..09e4fefa3 100644 --- a/inst/@sym/point.m +++ b/inst/@sym/point.m @@ -48,7 +48,7 @@ %% space = interval (sym (0), 7) * interval (sym (4), 9); %% p = point (sym (6), 7); %% contains (p, space) -%% @result{} ans = 1 +%% @result{} ans = (sym) True %% @end group %% @end example %% diff --git a/inst/@sym/psets.m b/inst/@sym/psets.m index c8190d324..0399e0453 100644 --- a/inst/@sym/psets.m +++ b/inst/@sym/psets.m @@ -29,21 +29,17 @@ %% c = interval (sym (1), 7); %% %% psets (complexregion (a * b)) -%% @result{} ans = -%% @{ -%% (sym) [2, 3] × [4, 5] -%% @} +%% @result{} ans = (sym) [2, 3] × [4, 5] %% @end group %% @end example %% %% @example %% @group %% psets (complexregion (a * b + b * c)) -%% @result{} ans = -%% @{ -%% (sym) [2, 3] × [4, 5] -%% (sym) [4, 5] × [1, 7] -%% @} +%% @result{} ans = (sym 2×1 matrix) +%% ⎡[2, 3] × [4, 5]⎤ +%% ⎢ ⎥ +%% ⎣[4, 5] × [1, 7]⎦ %% @end group %% @end example %% @@ -55,7 +51,7 @@ print_usage (); end - out = elementwise_op ('lambda x: x.psets', sym (x)); + out = python_cmd ('return Matrix(_ins[0].psets)', sym (x)); if nargout == 0 || nargout == 1 varargout = {out}; diff --git a/inst/@sym/rangeset.m b/inst/@sym/rangeset.m index fb5869307..1c4356d21 100644 --- a/inst/@sym/rangeset.m +++ b/inst/@sym/rangeset.m @@ -34,8 +34,8 @@ %% Example: %% @example %% @group -%% rangeset (sym (10), 0, -2) % doctest: +SKIP -%% @result{} ans = (sym) {10, 8, …, 2} +%% rangeset (sym (10), 0, -2) +%% @result{} ans = (sym) @{10, 8, …, 2@} %% @end group %% @end example %% @@ -57,13 +57,13 @@ %% Note, in Sympy 1.0 the negative steps produce a sorted %% output, over 1.0 don't is sorted. - varargin = cellfun(@sym, varargin, 'UniformOutput', false); - if strcmp (varargin{nargin}, 'list') - y = python_cmd ('return list(Range(*_ins[:-1])),', varargin{:}); + varargin = cellfun(@sym, varargin, 'UniformOutput', false); + y = python_cmd ('return list(Range(*_ins)),', varargin{1:3}); y = cell2sym (y); else - y = python_cmd ('return Range(*_ins),', varargin{:}); + varargin = cellfun(@sym, varargin, 'UniformOutput', false); + y = elementwise_op ('lambda a, b, c: Range(a, b, c)', varargin{:}); end end