コード例 #1
0
 def test_BoolValsetNget(self):
     typeSystemFilePath = 'tests/testing_data/typesystem.xml'
     typesystem = TypeSystemFactory.readTypeSystem(self, typeSystemFilePath)
     fstype4 = typesystem.getType(
         'de.tudarmstadt.ukp.dkpro.core.api.metadata.type.TagDescription')
     fsTagDesc1 = TOP(fstype4, 1, typesystem)
     aFeature = Feature(fsTagDesc1.FStype, 'name')
     aFeature.description = ''
     aFeature.elementType = 'uima.cas.Boolean'
     fsTagDesc1.setBoolValue(aFeature, False)
     self.assertEqual(fsTagDesc1.getBoolValue(aFeature), False)
コード例 #2
0
 def test_setBoolVal_Fail(self):
     typeSystemFilePath = 'typesystem.xml'
     typesystem = TypeSystemFactory.readTypeSystem(self, typeSystemFilePath)
     fstype4 = typesystem.getType(
         'de.tudarmstadt.ukp.dkpro.core.api.metadata.type.TagDescription')
     fsTagDesc1 = TOP(fstype4, 1, typesystem)
     aFeature = Feature(fsTagDesc1.FStype, 'name')
     aFeature.description = ''
     aFeature.elementType = 'uima.cas.Boolean'
     self.assertEqual('', '')
     with self.assertRaises(TypeError):
         fsTagDesc1.setBoolValue(aFeature, 'False')
     with self.assertRaises(TypeError):
         nonfeature = 1
         fsTagDesc1.setBoolValue(nonfeature, False)
     with self.assertRaises(TypeError):
         aFeature.elementType = None
         fsTagDesc1.setBoolValue(aFeature, False)
     with self.assertRaises(TypeError):
         aFeature.elementType = 'uima.cas.Integer'
         fsTagDesc1.setBoolValue(aFeature, False)