Commit 8f8cb95a authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] test: recover deselected test on PathExtractor

parent b4e7fca4
......@@ -49,17 +49,24 @@ PathExtractor : abstract a trajectory as a set of path in the transition graph
from __future__ import print_function
import unittest
import sys
import pkg_resources
from antlr3 import ANTLRFileStream, CommonTokenStream
#from cadbiom.models.guard_transitions.translators.chart_xml_pid import MakeModelFromPidFile
from cadbiom.models.guard_transitions.translators.chart_xml_pid import MakeModelFromPidFile
from cadbiom.models.guard_transitions.translators.chart_lang import LangVisitor
from cadbiom.models.guard_transitions.extract_visitor import PathExtractor
#from cadbiom.models.guard_transitions.analyser.ana_visitors import TableVisitor
from cadbiom.models.guard_transitions.analyser.ana_visitors import TableVisitor
from cadbiom.models.guard_transitions.translators.cadlangLexer import cadlangLexer
from cadbiom.models.guard_transitions.translators.cadlangParser import cadlangParser
from cadbiom.models.guard_transitions.chart_model import ChartModel
import cadbiom.commons as cm
LOGGER = cm.logger()
class Reporter(object):
"""
Simple reporter for tests
......@@ -74,13 +81,14 @@ class Reporter(object):
"""
self.error = True
self.mess += "ERROR -> "+mes
print("\n\n"+ self.mess)
LOGGER.error(self.mess)
@unittest.skip("Test files not provided")
class TestExtractVisitors(unittest.TestCase):
"""
Test visitor for model extraction
"""
@unittest.skip("Test files not provided")
def test_exec1(self):
"""
Test on simple exp
......@@ -104,25 +112,30 @@ class TestExtractVisitors(unittest.TestCase):
lvi = LangVisitor(sys.stdout)
pex.extract_model.accept(lvi)
# def test_exec2(self):
# """
# test visitor execution
# """
# file_name = 'translators/tests/tgf_cano.xml'
# reporter = Reporter()
# parser = MakeModelFromPidFile(file_name, reporter)
# if reporter.error:
# print 'ERROR IN READING FILE'
# model = parser.model
#
# tvi = TableVisitor(reporter)
# model.accept(tvi)
#
# target = ['TRAP_1']
# frontier = ['TGFBR2__dimer___active_intToMb',
# 'TGFBfamily__dimer___active_exCellRegion', 'CTGF']
# pex = PathExtractor(model, target, frontier, reporter)
# model.accept(pex)
# # decompiler visitor
# lvi = LangVisitor(sys.stdout)
# pex.extract_model.accept(lvi)
def test_exec2(self):
"""
test visitor execution
"""
file_name = pkg_resources.resource_filename(
__name__, # package name
'./translators/tests/tgf_cano.xml'
)
reporter = Reporter()
parser = MakeModelFromPidFile(file_name, reporter)
if reporter.error:
raise Exception("Error in reading file '%s'" % file_name)
model = parser.model
tvi = TableVisitor(reporter)
model.accept(tvi)
target = ['TRAP_1']
frontier = ['TGFBR2__dimer___active_intToMb',
'TGFBfamily__dimer___active_exCellRegion', 'CTGF']
pex = PathExtractor(model, target, frontier, reporter)
model.accept(pex)
# decompiler visitor
lvi = LangVisitor(sys.stdout)
pex.extract_model.accept(lvi)
# Note extracted model is the extract_model attribute of PathExtractor
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment