def test_parse_boolean_values(self): parameter = parse_parameter(""" string: myparameter [ needed: "yes" additional: "no" ]""") self.assertEqual(parameter.attributes['needed']['default_value'], True) self.assertEqual(parameter.attributes['additional']['default_value'], False) parameter = parse_parameter(""" string: myparameter [ needed: "Y" additional: "N" ]""") self.assertEqual(parameter.attributes['needed']['default_value'], True) self.assertEqual(parameter.attributes['additional']['default_value'], False) parameter = parse_parameter(""" string: myparameter [ needed: "y" additional: "n" ]""") self.assertEqual(parameter.attributes['needed']['default_value'], True) self.assertEqual(parameter.attributes['additional']['default_value'], False) parameter = parse_parameter(""" string: myparameter [ needed: "true" additional: "false" ]""") self.assertEqual(parameter.attributes['needed']['default_value'], True) self.assertEqual(parameter.attributes['additional']['default_value'], False) def bad_value_parse(): parse_parameter(""" string: myparameter [ needed: "W" ]""") self.assertRaises(acd.InvalidAcdPropertyValue, bad_value_parse)
def test_parse_parameter(self): parameter = parse_parameter(""" string: myparameter [ information: "parameter information" prompt: "test prompt" needed: "yes" additional: "no" ]""") self.assertEqual(parameter.name, 'myparameter') self.assertEqual(parameter.attributes['information'], 'parameter information') self.assertEqual(parameter.attributes['prompt'], 'test prompt')
def bad_value_parse(): parse_parameter(""" string: myparameter [ needed: "W" ]""")