diff --git a/acto/schema/array.py b/acto/schema/array.py index 2595e7c66..16acb37d3 100644 --- a/acto/schema/array.py +++ b/acto/schema/array.py @@ -127,6 +127,10 @@ def gen(self, exclude_value=None, minimum: bool = False, **kwargs) -> list: num = 0 if "size" in kwargs and kwargs["size"] is not None: num = kwargs["size"] + elif minimum: + num = self.min_items + else: + num = random.randint(self.min_items, self.max_items) if self.enum is not None: if exclude_value is not None: @@ -145,10 +149,6 @@ def gen(self, exclude_value=None, minimum: bool = False, **kwargs) -> list: # XXX: need to handle exclude_value, but not important for now for array types result = [] - if minimum: - num = self.min_items - else: - num = random.randint(self.min_items, self.max_items) for _ in range(num): result.append(self.item_schema.gen(minimum=minimum)) return result diff --git a/test/integration_tests/test_semantic_tests.py b/test/integration_tests/test_semantic_tests.py index 46570f97e..a23baa0b3 100644 --- a/test/integration_tests/test_semantic_tests.py +++ b/test/integration_tests/test_semantic_tests.py @@ -113,12 +113,14 @@ def test_rbop_tests(self): curr_input_with_schema, field_path, testcase, setup=True ) - if not testcase.test_precondition( - curr_input_with_schema.get_value_by_path(list(field_path)) - ): + field_curr_value = curr_input_with_schema.get_value_by_path( + list(field_path) + ) + if not testcase.test_precondition(field_curr_value): raise AssertionError( "Test precondition failed after applying the test case" f" {testcase} to the field {field_path_str}" + f" current value: {field_curr_value}" ) group.finish_testcase()