Updated sheerka.value() and added unit tests

This commit is contained in:
2019-12-21 16:15:54 +01:00
parent 41e0885486
commit 2474b08150
3 changed files with 14 additions and 27 deletions
-23
View File
@@ -45,7 +45,6 @@ class BuiltinConcepts(Enum):
ENUMERATION = "enum" # represents a list or a set
LIST = "list" # represents a list
CANNOT_RESOLVE_VALUE_ERROR = "value cannot be resolved" # don't know how to find concept value
CONCEPT_NOT_INITIALIZED = "concept not evaluated" # Try to work on a concept that is not evaluated
NODE = "node"
GENERIC_NODE = "generic node"
@@ -69,7 +68,6 @@ BuiltinErrors = [str(e) for e in {
BuiltinConcepts.CONCEPT_ALREADY_DEFINED,
BuiltinConcepts.CONCEPT_EVAL_ERROR,
BuiltinConcepts.CANNOT_RESOLVE_VALUE_ERROR,
BuiltinConcepts.CONCEPT_NOT_INITIALIZED
}]
"""
@@ -293,27 +291,6 @@ class ConceptEvalError(Concept):
return self.props["property_name"].value
class ConceptNotInitialized(Concept):
def __init__(self, error=None, concept=None, property_name=None):
super().__init__(BuiltinConcepts.CONCEPT_NOT_INITIALIZED,
True,
False,
BuiltinConcepts.CONCEPT_NOT_INITIALIZED,
error)
self.set_prop("concept", concept)
def __repr__(self):
return f"ConceptNotInitialized(error={self.error}, concept={self.concept})"
@property
def error(self):
return self.body
@property
def concept(self):
return self.props["concept"].value
class EnumerationConcept(Concept):
def __init__(self, iteration=None):
super().__init__(BuiltinConcepts.ENUMERATION, True, False, BuiltinConcepts.ENUMERATION, iteration)