change if bad to assert not bad, message 44/98344/1
authoranushadasari <danush10@in.ibm.com>
Wed, 13 Nov 2019 07:57:51 +0000 (13:27 +0530)
committeranushadasari <danush10@in.ibm.com>
Wed, 13 Nov 2019 07:58:05 +0000 (13:28 +0530)
eliminates if statement

Issue-ID: VVP-295
Change-Id: Ifa4a6cbaf79bfcab089fe9da4893aac661d70230
Signed-off-by: anushadasari <danush10@in.ibm.com>
ice_validator/tests/test_vm_type_case.py

index db4646c..6919404 100644 (file)
@@ -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