Exemplo n.º 1
0
    def test_schema(self):
        schema_item = SchemaItem("TestItem")
        self.assertIsInstance(schema_item, SchemaItem)
        self.assertEqual(schema_item.iget_type(6),
                         ContentTypeEnum.CONFIG_STRING)
        schema_item.iset_type(0, ContentTypeEnum.CONFIG_INT)
        self.assertEqual(schema_item.iget_type(0), ContentTypeEnum.CONFIG_INT)
        schema_item.set_argc_minmax(3, 6)

        del schema_item
Exemplo n.º 2
0
    def test_schema(self):
        schema_item = SchemaItem("TestItem")
        self.assertIsInstance(schema_item, SchemaItem)
        self.assertEqual(schema_item.iget_type(6), ContentTypeEnum.CONFIG_STRING)
        schema_item.iset_type(0, ContentTypeEnum.CONFIG_INT)
        self.assertEqual(schema_item.iget_type(0), ContentTypeEnum.CONFIG_INT)
        schema_item.set_argc_minmax(3, 6)

        del schema_item
Exemplo n.º 3
0
 def __getitem__(self, key):
     if key in self:
         item = self._get_item(key)
         item.setParent(self)
         return item
     else:
         if key in self._parser:
             schema_item = SchemaItem(key)
             return ContentItem(schema_item)
         else:
             raise KeyError("No such key: %s" % key)
Exemplo n.º 4
0
    def test_schema(self):
        schema_item = SchemaItem("TestItem")
        self.assertIsInstance(schema_item, SchemaItem)
        self.assertEqual(schema_item.iget_type(6),
                         ContentTypeEnum.CONFIG_STRING)
        schema_item.iset_type(0, ContentTypeEnum.CONFIG_INT)
        self.assertEqual(schema_item.iget_type(0), ContentTypeEnum.CONFIG_INT)
        schema_item.set_argc_minmax(3, 6)

        self.assertTrue(
            SchemaItem.validString(ContentTypeEnum.CONFIG_INT, "100"))
        self.assertFalse(
            SchemaItem.validString(ContentTypeEnum.CONFIG_INT, "100.99"))
        self.assertTrue(
            SchemaItem.validString(ContentTypeEnum.CONFIG_FLOAT, "100.99"))
        self.assertFalse(
            SchemaItem.validString(ContentTypeEnum.CONFIG_FLOAT, "100.99X"))
        self.assertTrue(
            SchemaItem.validString(ContentTypeEnum.CONFIG_STRING, "100.99XX"))
        self.assertTrue(
            SchemaItem.validString(ContentTypeEnum.CONFIG_PATH, "100.99XX"))

        del schema_item
Exemplo n.º 5
0
 def __getitem__(self,key):
     if key in self:
         string_value = self._get( key )
         return SchemaItem.convert( self._get_type( key ) , string_value )
     else:
         raise KeyError("PlotSettings object does not support key:%s" % key)