예제 #1
0
    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)
예제 #2
0
 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')
예제 #3
0
 def bad_value_parse():
     parse_parameter("""
         string: myparameter [
         needed: "W"
     ]""")