From b0808761421d1909d8175986dce7e9ec247515ad Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 11 Nov 2016 22:57:16 +0800 Subject: configs/checkers.py: Check missing before validating the values --- fg21sim/configs/checkers.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'fg21sim/configs/checkers.py') diff --git a/fg21sim/configs/checkers.py b/fg21sim/configs/checkers.py index 0788443..1ab2a85 100644 --- a/fg21sim/configs/checkers.py +++ b/fg21sim/configs/checkers.py @@ -55,12 +55,20 @@ def check_common(configs): results = {} # "common/nside" must be a power of 2 key = "common/nside" - if not _is_power2(configs.getn(key)): - results[key] = "not a power of 2" + res = _check_missing(configs, key) + if res == {}: + if not _is_power2(configs.getn(key)): + results[key] = "not a power of 2" + else: + results.update(res) # "common/lmax" must be greater than "common/lmin" key = "common/lmax" - if configs.getn(key) <= configs.getn("common/lmin"): - results[key] = "not greater than 'common/lmin'" + res = _check_missing(configs, [key, "common/lmin"]) + if res == {}: + if configs.getn(key) <= configs.getn("common/lmin"): + results[key] = "not greater than 'common/lmin'" + else: + results.update(res) # Check enabled components key = "common/components" if len(configs.getn(key)) == 0: -- cgit v1.2.2