From 00c64458942602efe5a3b712540b98ac94fb60f4 Mon Sep 17 00:00:00 2001 From: anushadasari Date: Wed, 13 Nov 2019 13:27:51 +0530 Subject: [PATCH] change if bad to assert not bad, message eliminates if statement Issue-ID: VVP-295 Change-Id: Ifa4a6cbaf79bfcab089fe9da4893aac661d70230 Signed-off-by: anushadasari --- ice_validator/tests/test_vm_type_case.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/ice_validator/tests/test_vm_type_case.py b/ice_validator/tests/test_vm_type_case.py index db4646c..6919404 100644 --- a/ice_validator/tests/test_vm_type_case.py +++ b/ice_validator/tests/test_vm_type_case.py @@ -111,14 +111,10 @@ def test_vm_type_case(yaml_file): param = param[0] if isinstance(param, str) and case_mismatch(vm_type, param): bad[(rid, vm_type)].append((prop, param)) - if bad: - raise AssertionError( - "vm-type/parameter case mis-match %s" - % ( - "; ".join( - "resource: %s vm-type: %s %s" - % (k[0], k[1], ", ".join("%s: %s" % i for i in v)) - for k, v in bad.items() - ) - ) - ) + + msg = 'vm-type/parameter case mis-match %s' \ + % '; '.join('resource: %s vm-type: %s %s' % (k[0], k[1], + ', '.join('%s: %s' % i for i in v)) for (k, v) in + bad.items()) + + assert not bad, msg -- 2.16.6