diff --git a/conversion_utils/jos_msds_and_properties.py b/conversion_utils/jos_msds_and_properties.py index df1f046..3912f5d 100644 --- a/conversion_utils/jos_msds_and_properties.py +++ b/conversion_utils/jos_msds_and_properties.py @@ -379,16 +379,20 @@ class Converter: category_char = msd.code[0].lower() value_chars = msd.code[1:] category = self.specifications.find_category_by_code(category_char, msd.language) + if category is None: + raise MsdException(f"Msd '{msd.code}' cannot be converted to Properties: unknown category '{category_char}'.") category_name = category.names.get(language) feature_value_list = [] lexeme_feature_map = {} form_feature_map = {} - if msd.state not in [Msd.State.FULL, Msd.State.PARTIAL]: - raise MsdException(f"Msd must be full or partial to be converted to Properties, but is {msd.state.name}.") for (index, value_char) in enumerate(value_chars, start=1): if (value_char != '-'): feature = category.find_feature_by_position(index) + if feature is None: + raise MsdException(f"Msd '{msd.code}' cannot be converted to Properties: no feature at position {index}.") value = feature.find_value_by_char(value_char, msd.language) + if value is None: + raise MsdException(f"Msd '{msd.code}' cannot be converted to Properties: unknown value '{value_char}' at position {index}.") feature_name = feature.names.get(language) feature_value = value.names.get(language) if (warn_level_flag and lemma is None and (category_name, index) in [(le[0], le[1]) for le in LEVEL_EXCEPTIONS]): diff --git a/setup.py b/setup.py index 711f7e5..8ee0514 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup(name='cjvt_conversion_utils', - version='0.4.1', + version='0.4.2', description='CJVT conversion utilities', long_description=long_description, long_description_content_type="text/markdown",