def setUp(self): Logger.init_logger(LoggingLevel.INFO) SymbolTable.initialize_symbol_table(ASTSourceLocation(start_line=0, start_column=0, end_line=0, end_column=0)) PredefinedUnits.register_units() PredefinedTypes.register_types() PredefinedVariables.register_variables() PredefinedFunctions.register_functions()
def setUp(self): PredefinedUnits.register_units() PredefinedTypes.register_types() PredefinedFunctions.register_functions() PredefinedVariables.register_variables() SymbolTable.initialize_symbol_table(ASTSourceLocation(start_line=0, start_column=0, end_line=0, end_column=0)) Logger.init_logger(LoggingLevel.INFO) self.target_path = str(os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.join( os.pardir, 'target'))))
def setUp(self) -> None: PredefinedUnits.register_units() PredefinedTypes.register_types() PredefinedFunctions.register_functions() PredefinedVariables.register_variables() SymbolTable.initialize_symbol_table(ASTSourceLocation(start_line=0, start_column=0, end_line=0, end_column=0)) Logger.init_logger(LoggingLevel.INFO) self.target_path = str(os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.join(os.pardir, 'target'))))
from antlr4 import * from pynestml.meta_model.ast_nestml_compilation_unit import ASTNestMLCompilationUnit from pynestml.utils.ast_source_location import ASTSourceLocation from pynestml.generated.PyNestMLLexer import PyNestMLLexer from pynestml.generated.PyNestMLParser import PyNestMLParser from pynestml.symbol_table.symbol_table import SymbolTable from pynestml.symbols.predefined_functions import PredefinedFunctions from pynestml.symbols.predefined_types import PredefinedTypes from pynestml.symbols.predefined_units import PredefinedUnits from pynestml.symbols.predefined_variables import PredefinedVariables from pynestml.utils.logger import LoggingLevel, Logger from pynestml.visitors.ast_builder_visitor import ASTBuilderVisitor # setups the infrastructure PredefinedUnits.register_units() PredefinedTypes.register_types() PredefinedFunctions.register_functions() PredefinedVariables.register_variables() SymbolTable.initialize_symbol_table( ASTSourceLocation(start_line=0, start_column=0, end_line=0, end_column=0)) Logger.init_logger(LoggingLevel.INFO) class ASTBuildingTest(unittest.TestCase): def test(self): for filename in os.listdir( os.path.realpath( os.path.join(os.path.dirname(__file__), os.path.join('..', 'models')))): if filename.endswith(".nestml"):
def init_predefined(): # initialize the predefined elements PredefinedUnits.register_units() PredefinedTypes.register_types() PredefinedFunctions.register_functions() PredefinedVariables.register_variables()
# along with NEST. If not, see <http://www.gnu.org/licenses/>. import unittest from pynestml.meta_model.ast_source_location import ASTSourceLocation from pynestml.symbol_table.symbol_table import SymbolTable from pynestml.symbols.predefined_functions import PredefinedFunctions from pynestml.symbols.predefined_types import PredefinedTypes from pynestml.symbols.predefined_units import PredefinedUnits from pynestml.symbols.predefined_variables import PredefinedVariables from pynestml.utils.ast_nestml_printer import ASTNestMLPrinter from pynestml.utils.logger import LoggingLevel, Logger from pynestml.utils.model_parser import ModelParser # setups the infrastructure PredefinedUnits.register_units() PredefinedTypes.register_types() PredefinedFunctions.register_functions() PredefinedVariables.register_variables() SymbolTable.initialize_symbol_table(ASTSourceLocation(start_line=0, start_column=0, end_line=0, end_column=0)) Logger.init_logger(LoggingLevel.INFO) class NestMLPrinterTest(unittest.TestCase): """ Tests if the NestML printer works as intended. """ def test_block_with_variables_with_comments(self): block = '\n' \ '/* pre1\n' \