Пример #1
0
    def testTypes(self):
        p = ParameterInfo(None, "p0")
        y = self.createData("p1", cpp_type="vector<string>", basic_type="Array", default=None)
        p.setFromData(y)
        self.assertEqual(p.needsQuotes(), True)
        self.assertEqual(p.isVectorType(), True)
        self.assertEqual(p.default, "")
        p.value = "foo"
        self.assertEqual(p.inputFileValue(), "'foo'")

        y = self.createData("p1", cpp_type="bool", basic_type="Boolean", default="0")
        p.setFromData(y)
        self.assertEqual(p.value, "false")
        self.assertEqual(p.default, "false")
        self.assertEqual(p.needsQuotes(), False)
        self.assertEqual(p.isVectorType(), False)
        self.assertEqual(p.inputFileValue(), "false")

        y = self.createData("p1", cpp_type="bool", basic_type="Boolean", default="1")
        p.setFromData(y)
        self.assertEqual(p.value, "true")
        self.assertEqual(p.default, "true")

        y = self.createData("p1", cpp_type="bool")
        p.setFromData(y)
        self.assertEqual(p.value, "false")
        self.assertEqual(p.default, "false")
Пример #2
0
    def testTypes(self):
        p = ParameterInfo(None, "p0")
        y = self.createData("p1", cpp_type="vector<string>", basic_type="Array", default=None)
        p.setFromData(y)
        self.assertEqual(p.needsQuotes(), True)
        self.assertEqual(p.isVectorType(), True)
        self.assertEqual(p.default, "")
        p.value = "foo"
        self.assertEqual(p.inputFileValue(), "'foo'")

        y = self.createData("p1", cpp_type="bool", basic_type="Boolean", default="0")
        p.setFromData(y)
        self.assertEqual(p.value, "false")
        self.assertEqual(p.default, "false")
        self.assertEqual(p.needsQuotes(), False)
        self.assertEqual(p.isVectorType(), False)
        self.assertEqual(p.inputFileValue(), "false")

        y = self.createData("p1", cpp_type="bool", basic_type="Boolean", default="1")
        p.setFromData(y)
        self.assertEqual(p.value, "true")
        self.assertEqual(p.default, "true")

        y = self.createData("p1", cpp_type="bool")
        p.setFromData(y)
        self.assertEqual(p.value, "false")
        self.assertEqual(p.default, "false")
Пример #3
0
 def testBasic(self):
     p = ParameterInfo(None, "p0")
     y = self.createData("p1",
                         default="foo",
                         cpp_type="some type",
                         description="description",
                         group_name="group",
                         required=True)
     p.setFromData(y)
     y["default"] = "foo"
     self.checkParameter(p,
                         "p1",
                         value="foo",
                         default="foo",
                         cpp_type="some type",
                         description="description",
                         group_name="group",
                         required=True)
Пример #4
0
 def testBasic(self):
     p = ParameterInfo(None, "p0")
     y = self.createData("p1", default="foo", cpp_type="some type", description="description", group_name="group", required=True)
     p.setFromData(y)
     y["default"] = "foo"
     self.checkParameter(p, "p1", value="foo", default="foo", cpp_type="some type", description="description", group_name="group", required=True)