sgilmore10 commented on code in PR #35977:
URL: https://github.com/apache/arrow/pull/35977#discussion_r1224685967


##########
matlab/test/arrow/args/tParseValidElements.m:
##########
@@ -0,0 +1,163 @@
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements.  See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License.  You may obtain a copy of the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied.  See the License for the specific language governing
+% permissions and limitations under the License.
+
+classdef tParseValidElements < matlab.unittest.TestCase
+    % Tests for arrow.args.parseValidElements
+    
+    methods(Test)
+        % Test methods
+        function InferNullsTrue(testCase)
+        % Verify values for which ismissing returns true for are not
+        % considered valid.
+            data = [1 NaN 3 NaN 5];
+            validElements = parseValidElements(data, InferNulls=true);
+            expectedValidElements = [true; false; true; false; true];
+            testCase.verifyEqual(validElements, expectedValidElements);
+
+            data = [1 2 3];
+            validElements = parseValidElements(data, InferNulls=true);
+            expectedValidElements = [true; true; true];
+            testCase.verifyEqual(validElements, expectedValidElements);
+        end
+
+        function InferNullsFalse(testCase)
+        % Verify all elements are treated as Valid wen InferNulls=false is
+        % provided - including values for which that ismissing returns true.
+            data = [1 NaN 3 NaN 5];
+            validElements = parseValidElements(data, InferNulls=false);
+            expectedValidElements = [true; true; true; true; true];
+            testCase.verifyEqual(validElements, expectedValidElements);
+        end
+
+        function LogicalValid(testCase)
+            data = [1 2 3]; 
+
+            % Supply a scalar true value for Valid 
+            validElements = parseValidElements(data, Valid=true);
+            expectedValidElements = [true; true; true];
+            testCase.verifyEqual(validElements, expectedValidElements);
+
+            % Supply a scalar false value for Valid
+            validElements = parseValidElements(data, Valid=false);
+            expectedValidElements = [false; false; false];
+            testCase.verifyEqual(validElements, expectedValidElements);
+
+            % Supply a logical vector for Valid
+            validElements = parseValidElements(data, Valid=[false; true; 
true]);
+            expectedValidElements = [false; true; true];
+            testCase.verifyEqual(validElements, expectedValidElements);
+        end
+
+        function NumericValid(testCase)
+            data = [1 2 3]; 
+
+            % Supply 1 valid index for Valid
+            validElements = parseValidElements(data, Valid=2);
+            expectedValidElements = [false; true; false];
+            testCase.verifyEqual(validElements, expectedValidElements);
+
+            % Supply a numeric vector for Valid 
+            validElements = parseValidElements(data, Valid=[1 3]);
+            expectedValidElements = [true; false; true];
+            testCase.verifyEqual(validElements, expectedValidElements);
+        end
+
+        function ComplexValidIndicesError(testCase)
+        % Verify parseValidElements errors if Valid is a numeric array
+        % containing complex numbers.

Review Comment:
   Hi @kou,
   
   We discussed this a bit further and in retrospect, we think it's probably 
best to stick with MATLAB's auto-indentation behavior (which is to not indent 
top-level function comments). This should help reduce confusion for future 
contributors if they stick with the MATLAB default indentation rules.
   
   Sorry it took us some time to figure out the right path forward, but thank 
you for bringing this up. I'll make the changes in this PR. 
   
   Best,
   Sarah
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to