Implemented SheerkaOntology
This commit is contained in:
@@ -4,16 +4,19 @@ import pytest
|
||||
from core.builtin_concepts import ReturnValueConcept, BuiltinConcepts
|
||||
from core.concept import Concept
|
||||
from core.rule import Rule
|
||||
from core.sheerka.Sheerka import Sheerka
|
||||
from core.sheerka.SheerkaOntologyManager import SheerkaOntologyManager
|
||||
from core.sheerka.services.SheerkaComparisonManager import SheerkaComparisonManager
|
||||
from core.sheerka.services.SheerkaOut import SheerkaOut
|
||||
from core.sheerka.services.SheerkaRuleManager import FormatAstRawText, FormatAstVariable, FormatAstSequence, \
|
||||
FormatAstColor, FormatAstVariableNotFound, FormatAstList, FormatAstDict
|
||||
FormatAstColor, FormatAstVariableNotFound, FormatAstList, FormatAstDict, SheerkaRuleManager
|
||||
from core.utils import flatten_all_children
|
||||
|
||||
from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
|
||||
|
||||
seq = FormatAstSequence
|
||||
raw = FormatAstRawText
|
||||
var = FormatAstVariable
|
||||
|
||||
def seq(*args, **kwargs):
|
||||
return FormatAstSequence(*args, **kwargs)
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -24,6 +27,20 @@ class DummyObj:
|
||||
|
||||
class TestSheerkaOut(TestUsingMemoryBasedSheerka):
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
sheerka = cls().get_sheerka(cache_only=False, ontology="#TestSheerkaOut#")
|
||||
sheerka.om.clear(SheerkaRuleManager.FORMAT_RULE_ENTRY)
|
||||
sheerka.om.clear(SheerkaComparisonManager.COMPARISON_ENTRY)
|
||||
sheerka.om.clear(SheerkaComparisonManager.RESOLVED_COMPARISON_ENTRY)
|
||||
sheerka.om.delete(Sheerka.OBJECTS_IDS_ENTRY, SheerkaRuleManager.RULE_IDS)
|
||||
cls.root_ontology_name = "#TestSheerkaOut#"
|
||||
|
||||
@classmethod
|
||||
def teardown_class(cls):
|
||||
cls.sheerka.pop_ontology()
|
||||
cls.root_ontology_name = SheerkaOntologyManager.ROOT_ONTOLOGY_NAME
|
||||
|
||||
def init_service_with_rules(self, *rules, **kwargs):
|
||||
sheerka, context, *rules = self.init_format_rules(*rules, **kwargs)
|
||||
service = sheerka.services[SheerkaOut.NAME]
|
||||
|
||||
Reference in New Issue
Block a user