Sanity checks for bags.

This commit is contained in:
Artur Meski
2017-03-15 22:33:14 +01:00
parent 9ed2104757
commit 56d4d8fde8

View File

@@ -8,6 +8,8 @@ class BagDescription(object):
self.right_operand = R_oper self.right_operand = R_oper
self.entity = entity self.entity = entity
self.sanity_check()
def __repr__(self): def __repr__(self):
if self.f_type == BagDesc_oper.entity: if self.f_type == BagDesc_oper.entity:
return self.entity return self.entity
@@ -31,11 +33,12 @@ class BagDescription(object):
return repr(self.left_operand) + " > " + repr(self.right_operand) return repr(self.left_operand) + " > " + repr(self.right_operand)
def sanity_check(self): def sanity_check(self):
"""Checks if the right operands for the relations are integers""" """Sanity checks"""
# TODO for operand in (self.left_operand, self.right_operand):
if operand:
pass if not (isinstance(operand, BagDescription) or isinstance(operand, int)):
raise RuntimeError("Unexpected operand type for a bag: " + str(operand))
@classmethod @classmethod
def f_entity(cls, entity_name): def f_entity(cls, entity_name):