From 01103d673995f62f4e9f0f530e84e8f2ff0e3d88 Mon Sep 17 00:00:00 2001 From: Daniel Bengtsson Date: Thu, 4 Mar 2021 00:21:06 +0100 Subject: [PATCH] Refactor the groups property in Validation class. Improve the code and remove the condition to check the groups. Use the default value from the get method. Co-authored-by: Owen McGonagle Change-Id: I693ba3699ab2c1b50f92b4f60f309d8c529a23c4 --- validations_libs/validation.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/validations_libs/validation.py b/validations_libs/validation.py index ce4a7d80..68e5472a 100644 --- a/validations_libs/validation.py +++ b/validations_libs/validation.py @@ -219,11 +219,7 @@ class Validation(object): ['group1', 'group2'] """ if self.has_metadata_dict: - groups = self.dict['vars']['metadata'].get('groups') - if groups: - return groups - else: - return [] + return self.dict['vars']['metadata'].get('groups', []) else: raise NameError( "No metadata found in validation {}".format(self.id)