Skip to content
Snippets Groups Projects
Commit c53f7a6d authored by Joseph Weston's avatar Joseph Weston
Browse files

add compatibility check between site families and delta in HoppingKinds

parent 9b205b5a
No related branches found
No related tags found
No related merge requests found
...@@ -442,6 +442,17 @@ class HoppingKind(tuple): ...@@ -442,6 +442,17 @@ class HoppingKind(tuple):
else: else:
ensure_isinstance(family_b, SiteFamily) ensure_isinstance(family_b, SiteFamily)
family_b = family_b family_b = family_b
try:
Site(family_b, family_a.normalize_tag(delta) - delta)
except Exception as e:
same_fams = family_b is family_a
msg = (str(family_a),
'and {} are'.format(family_b) if not same_fams else ' is',
'not compatible with delta={}'.format(delta),
)
raise ValueError(' '.join(msg)) from e
return tuple.__new__(cls, (delta, family_a, family_b)) return tuple.__new__(cls, (delta, family_a, family_b))
def __call__(self, builder): def __call__(self, builder):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment