def test_is_collection(type_name: str, feature_name: str, expected: bool): typesystem = TypeSystem() t = typesystem.get_type(type_name) feature = Feature("test_feature", rangeTypeName=feature_name) t.add_feature(feature) assert typesystem.is_collection(type_name, feature) == expected
def test_feature_can_be_added(): typesystem = TypeSystem() test_type = typesystem.create_type(name="test.Type") typesystem.add_feature(type_=test_type, name="testFeature", rangeTypeName="String", description="A test feature") actual_type = typesystem.get_type("test.Type") actual_feature = actual_type.get_feature("testFeature") assert actual_feature.name == "testFeature" assert actual_feature.rangeTypeName == "String" assert actual_feature.description == "A test feature"
def test_is_collection_for_builtin_collections_with_elements(type_name: str): typesystem = TypeSystem() t = typesystem.get_type(type_name) feature = Feature("elements", rangeTypeName="uima.cas.TOP") assert typesystem.is_collection(type_name, feature) is True