예제 #1
0
 def test_invalid_expression_correctly_typed(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'invalid')),
                      'CoCoIllegalExpression.nestml'))
     self.assertEqual(len(Logger.get_all_messages_of_level_and_or_neuron(model.get_neuron_list()[0],
                                                                         LoggingLevel.ERROR)), 6)
예제 #2
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_continuous_input_ports_not_specified(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoContinuousInputPortQualifierSpecified.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #3
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_spike_input_port_without_datatype(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoSpikeInputPortWithoutType.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #4
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_ode_correctly_typed(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoOdeCorrectlyTyped.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #5
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_parameters_assigned_only_in_parameters_block(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoParameterAssignedOutsideBlock.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #6
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_ode_vars_outside_init_block_detected(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoOdeVarNotInInitialValues.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #7
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_invalid_convolve_correctly_parameterized(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'invalid')),
                      'CoCoConvolveNotCorrectlyParametrized.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 1)
예제 #8
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_no_values_assigned_to_input_ports(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoValueAssignedToInputPort.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #9
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_invalid_order_of_equations_correct(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'invalid')),
                      'CoCoNoOrderOfEquations.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 2)
예제 #10
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_function_unique_and_defined(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoFunctionNotUnique.nestml'))
     self.assertEqual(
         len(Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #11
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_inline_expression_has_several_lhs(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoInlineExpressionWithSeveralLhs.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #12
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_invalid_each_block_unique(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'invalid')),
                      'CoCoEachBlockUnique.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 2)
예제 #13
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_invalid_variable_redeclaration(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'invalid')),
                      'CoCoVariableRedeclared.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 1)
예제 #14
0
파일: cocos_test.py 프로젝트: pnbabu/nestml
 def test_invalid_current_buffers_not_specified_with_keywords(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'invalid')),
                      'CoCoCurrentBufferQualifierSpecified.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 1)
예제 #15
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_init_values_have_rhs_and_ode(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoInitValuesWithoutOde.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.WARNING)), 2)
예제 #16
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_numerator_of_unit_one(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoUnitNumeratorNotOne.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #17
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_incorrect_return_stmt_detected(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoIncorrectReturnStatement.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #18
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_no_nest_collision(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoNestNamespaceCollision.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #19
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_vector_parameter_size(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoVectorDeclarationSize.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #20
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_redundant_input_port_keywords_detected(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoInputPortWithRedundantTypes.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #21
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_compound_expression_correctly_typed(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CompoundOperatorWithDifferentButCompatibleUnits.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #22
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_function_with_wrong_arg_number_detected(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoFunctionCallNotConsistentWrongArgNumber.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #23
0
 def test_invalid_vector_in_non_vector_declaration_detected(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'invalid')),
                      'CoCoVectorInNonVectorDeclaration.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_neuron(model.get_neuron_list()[0], LoggingLevel.ERROR)), 1)
예제 #24
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_invalid_element_not_defined_in_scope(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'invalid')),
                      'CoCoVariableNotDefined.nestml'))
     self.assertEqual(len(Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0],
                                                                       LoggingLevel.ERROR)), 4)
예제 #25
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_integrate_odes_called_if_equations_defined(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoIntegrateOdesCalledIfEquationsDefined.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #26
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_element_in_same_line(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoElementInSameLine.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #27
0
 def test_invalid_inline_expression_has_several_lhs(self):
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(
             os.path.realpath(
                 os.path.join(os.path.dirname(__file__), 'invalid')),
             'CoCoInlineExpressionWithSeveralLhs.nestml'))
     assert model is None
예제 #28
0
    def test_expression_after_magnitude_conversion_in_direct_assignment(self):
        Logger.set_logging_level(LoggingLevel.NO)
        model = ModelParser.parse_model(
            os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'resources')),
                         'DirectAssignmentWithDifferentButCompatibleUnits.nestml'))
        printed_rhs_expression = print_rhs_of_first_assignment_in_update_block(model)

        self.assertEqual(printed_rhs_expression, '1000.0 * (10*V)')
예제 #29
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_valid_output_port_defined_if_emit_call(self):
     """test that no error is raised when the output block is missing, but not emit_spike() functions are called"""
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'valid')),
                      'CoCoOutputPortDefinedIfEmitCall.nestml'))
     self.assertEqual(len(
         Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0], LoggingLevel.ERROR)), 0)
예제 #30
0
파일: cocos_test.py 프로젝트: nest/nestml
 def test_invalid_output_port_defined_if_emit_call(self):
     """test that an error is raised when the emit_spike() function is called by the neuron, but a spiking output port is not defined"""
     Logger.set_logging_level(LoggingLevel.INFO)
     model = ModelParser.parse_model(
         os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'invalid')),
                      'CoCoOutputPortDefinedIfEmitCall-2.nestml'))
     self.assertTrue(len(Logger.get_all_messages_of_level_and_or_node(model.get_neuron_list()[0],
                                                                      LoggingLevel.ERROR)) > 0)