def test_LongValsetNget(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.Long' fsTagDesc1.setLongValue(aFeature, 100000000) self.assertEqual(int(fsTagDesc1.getLongValue(aFeature)), 100000000)
def test_setLongVal_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.Integer' self.assertEqual('', '') with self.assertRaises(TypeError): fsTagDesc1.setIntValue(aFeature, '') with self.assertRaises(TypeError): nonfeature = 1 fsTagDesc1.setLongValue(nonfeature, 10000000) with self.assertRaises(TypeError): aFeature.elementType = None fsTagDesc1.setIntValue(aFeature, 100000000) with self.assertRaises(TypeError): aFeature.elementType = 'uima.cas.String' fsTagDesc1.setIntValue(aFeature, 100000000)