# Path: tests/test_bridgepoint/utils.py
# class PrebuildFunctionTestCase(CompareAST):
#     
#     @classmethod
#     def setUpClass(cls):
#         cls.loader = ooaofooa.Loader()
#         
#     def setUp(self):
#         self.metamodel = self.loader.build_metamodel()
#         pe_pe = self.metamodel.new('PE_PE')
#         s_sync = self.metamodel.new('S_SYNC')
#         xtuml.relate(s_sync, pe_pe, 8001)
#         
#         s_dt = self.metamodel.select_any('S_DT', lambda sel: sel.Name == 'void')
#         xtuml.relate(s_dt, s_sync, 25)
#         
#     def tearDown(self):
#         del self.metamodel
#         
#     def prebuild_text(self, s):
#         s_sync = self.metamodel.select_any('S_SYNC')
#         s_sync.Action_Semantics_internal = s
#         s_sync.Suc_Pars = 1
#         
#         prebuild.prebuild_model(self.metamodel)
#         self.assertTrue(self.metamodel.is_consistent())
#         
#         generated_code = sourcegen.gen_text_action(s_sync)
#         
#         handwritten_ast = oal.parse(s)
#         generated_ast = oal.parse(generated_code)
# 
#         self.compare(handwritten_ast, generated_ast)
# 
# Path: tests/test_bridgepoint/utils.py
# def prebuild_docstring(f):
#     
#     def wrapper(self):
#         self.prebuild_text(f.__doc__)
#         f(self)
#         
#     return wrapper
# 
# Path: xtuml/meta.py
# def navigate_one(self, instance):
#     '''
#     Navigate from *instance* across the link.
#     '''
#     return next(iter(self.navigate(instance)), None)
# 
# Path: xtuml/meta.py
# def relate(from_instance, to_instance, rel_id, phrase=''):
#     '''
#     Relate *from_instance* to *to_instance* across *rel_id*. For reflexive
#     association, a *phrase* indicating the direction must also be provided.
#     
#     The two instances are related to each other by copying the identifying 
#     attributes from the instance on the TO side of a association to the instance
#     n the FROM side. Updated values which affect existing associations are 
#     propagated. A set of all affected instances will be returned.
#     '''
#     if None in [from_instance, to_instance]:
#         return False
# 
#     inst1, inst2, ass = _find_link(from_instance, to_instance, rel_id, phrase)
#     if not ass.source_link.connect(inst1, inst2):
#         raise RelateException(from_instance, to_instance, rel_id, phrase)
# 
#     if not ass.target_link.connect(inst2, inst1):
#         raise RelateException(from_instance, to_instance, rel_id, phrase)
#     
#     return True
# 
# Path: xtuml/meta.py
# def where_eq(**kwargs):
#     '''
#     Return a where-clause that filters out instances based on named 
#     keywords.
#     
#     Usage example:
#     
#     >>> from xtuml import where_eq as where
#     >>> m = xtuml.load_metamodel('db.sql')
#     >>> inst = m.select_any('My_Modeled_Class', where(My_Number=5))
#     '''
#     return WhereEqual(kwargs)


from tests.test_bridgepoint.utils import PrebuildFunctionTestCase
from tests.test_bridgepoint.utils import prebuild_docstring
from xtuml import navigate_one as one
from xtuml import relate
from xtuml import where_eq as where
    import logging
    import unittest
                           Mning='my_second_event')
        
        self.metamodel.new('SM_ISM',
                           Obj_ID=o_obj.Obj_ID,
                           SM_ID=sm_sm.SM_ID)
        
        
        sm_sm = self.metamodel.new('SM_SM')       
        o_obj = self.metamodel.new('O_OBJ', Key_Lett='C')
        pe_pe = self.metamodel.new('PE_PE')
        relate(pe_pe, o_obj, 8001)
        sm_evt = self.metamodel.new('SM_EVT',
                                    SM_ID=sm_sm.SM_ID,
                                    SMspd_ID=self.metamodel.id_generator.next(),
                                    Numb=1,
                                    Drv_Lbl='C1',
                                    Mning='my_third_event')
        
        s_dt = self.metamodel.select_any('S_DT', where(Name='boolean'))
        self.metamodel.new('SM_EVTDI',
                           SM_ID=sm_sm.SM_ID,
                           SMevt_ID=sm_evt.SMevt_ID,
                           DT_ID=s_dt.DT_ID,
                           Name='di1')
        
        self.metamodel.new('SM_ISM',
                           Obj_ID=o_obj.Obj_ID,
                           SM_ID=sm_sm.SM_ID)
        
    @prebuild_docstring

# Path: tests/test_bridgepoint/utils.py
# class PrebuildFunctionTestCase(CompareAST):
#     
#     @classmethod
#     def setUpClass(cls):
#         cls.loader = ooaofooa.Loader()
#         
#     def setUp(self):
#         self.metamodel = self.loader.build_metamodel()
#         pe_pe = self.metamodel.new('PE_PE')
#         s_sync = self.metamodel.new('S_SYNC')
#         xtuml.relate(s_sync, pe_pe, 8001)
#         
#         s_dt = self.metamodel.select_any('S_DT', lambda sel: sel.Name == 'void')
#         xtuml.relate(s_dt, s_sync, 25)
#         
#     def tearDown(self):
#         del self.metamodel
#         
#     def prebuild_text(self, s):
#         s_sync = self.metamodel.select_any('S_SYNC')
#         s_sync.Action_Semantics_internal = s
#         s_sync.Suc_Pars = 1
#         
#         prebuild.prebuild_model(self.metamodel)
#         self.assertTrue(self.metamodel.is_consistent())
#         
#         generated_code = sourcegen.gen_text_action(s_sync)
#         
#         handwritten_ast = oal.parse(s)
#         generated_ast = oal.parse(generated_code)
# 
#         self.compare(handwritten_ast, generated_ast)
# 
# Path: tests/test_bridgepoint/utils.py
# def prebuild_docstring(f):
#     
#     def wrapper(self):
#         self.prebuild_text(f.__doc__)
#         f(self)
#         
#     return wrapper
# 
# Path: xtuml/meta.py
# def navigate_one(self, instance):
#     '''
#     Navigate from *instance* across the link.
#     '''
#     return next(iter(self.navigate(instance)), None)
# 
# Path: xtuml/meta.py
# def relate(from_instance, to_instance, rel_id, phrase=''):
#     '''
#     Relate *from_instance* to *to_instance* across *rel_id*. For reflexive
#     association, a *phrase* indicating the direction must also be provided.
#     
#     The two instances are related to each other by copying the identifying 
#     attributes from the instance on the TO side of a association to the instance
#     n the FROM side. Updated values which affect existing associations are 
#     propagated. A set of all affected instances will be returned.
#     '''
#     if None in [from_instance, to_instance]:
#         return False
# 
#     inst1, inst2, ass = _find_link(from_instance, to_instance, rel_id, phrase)
#     if not ass.source_link.connect(inst1, inst2):
#         raise RelateException(from_instance, to_instance, rel_id, phrase)
# 
#     if not ass.target_link.connect(inst2, inst1):
#         raise RelateException(from_instance, to_instance, rel_id, phrase)
#     
#     return True
# 
# Path: xtuml/meta.py
# def where_eq(**kwargs):
#     '''
#     Return a where-clause that filters out instances based on named 
#     keywords.
#     
#     Usage example:
#     
#     >>> from xtuml import where_eq as where
#     >>> m = xtuml.load_metamodel('db.sql')
#     >>> inst = m.select_any('My_Modeled_Class', where(My_Number=5))
#     '''
#     return WhereEqual(kwargs)


# Path: tests/test_bridgepoint/test_generate.py
from tests.test_bridgepoint.utils import PrebuildFunctionTestCase
from tests.test_bridgepoint.utils import prebuild_docstring
from xtuml import navigate_one as one
from xtuml import relate
from xtuml import where_eq as where
    import logging
    import unittest

                           Mning='my_second_event')
        
        self.metamodel.new('SM_ISM',
                           Obj_ID=o_obj.Obj_ID,
                           SM_ID=sm_sm.SM_ID)
        
        
        sm_sm = self.metamodel.new('SM_SM')       
        o_obj = self.metamodel.new('O_OBJ', Key_Lett='C')
        pe_pe = self.metamodel.new('PE_PE')
        relate(pe_pe, o_obj, 8001)
        sm_evt = self.metamodel.new('SM_EVT',
                                    SM_ID=sm_sm.SM_ID,
                                    SMspd_ID=self.metamodel.id_generator.next(),
                                    Numb=1,
                                    Drv_Lbl='C1',
                                    Mning='my_third_event')
        
        s_dt = self.metamodel.select_any('S_DT', where(Name='boolean'))
        self.metamodel.new('SM_EVTDI',
                           SM_ID=sm_sm.SM_ID,
                           SMevt_ID=sm_evt.SMevt_ID,
                           DT_ID=s_dt.DT_ID,
                           Name='di1')
        
        self.metamodel.new('SM_ISM',
                           Obj_ID=o_obj.Obj_ID,
                           SM_ID=sm_sm.SM_ID)
        
    @prebuild_docstring

    def test_generate_to_class(self):