From 5b45fc628edc83f6e921063c31ee15a722f58f05 Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Mon, 1 Jun 2015 15:17:35 -0700 Subject: [PATCH] updates to testing class creation --- SimPEG/PropMaps.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/SimPEG/PropMaps.py b/SimPEG/PropMaps.py index d4fcb85d..3bc11d3c 100644 --- a/SimPEG/PropMaps.py +++ b/SimPEG/PropMaps.py @@ -136,13 +136,19 @@ class _PropMapMetaClass(type): attrs['_properties'] = _properties - # You are only allowed one default inversion property. defaultInvProps = [] + for p in _properties: + prop = _properties[p] + if prop.defaultInvProp: + defaultInvProps += [p] + if prop.propertyLink is not None: + assert prop.propertyLink[0] in _properties, "You can only link to things that exist: '%s' is trying to link to '%s'"%(prop.name, prop.propertyLink[0]) + if len(defaultInvProps) > 1: + raise Exception('You have more than one default inversion property: %s' % defaultInvProps) + for p in _properties: if _properties[p].defaultInvProp: defaultInvProps += [p] - if len(defaultInvProps) > 1: - raise Exception('You have more than one default inversion property: %s' % defaultInvProps) newClass = super(_PropMapMetaClass, cls).__new__(cls, name, bases, attrs)