The current implementation of category_correspondence consists of a series of if-statements checking for membership in lists, but then falls back to a default (None, None) value intended for when the alternate subcategory is Beliefs or Practices:
# Accounts for AlternateSubcategory.PRACTICES and AlternateSubcategory.BELIEFS
return (None, None)
But if an alternate subcategory not covered by the if-statements is passed, it will also return (None, None), which is potentially undesired behavior as it conflates an unmapped value with the expected output of beliefs or practices.
I would suggest changing this so it raises an error if an alternate subcategory isn't explicitly mapped to a category or subcategory.
if typed_alt_subcat in [
AlternateSubcategory.PRACTICES,
AlternateSubcategory.BELIEFS
]:
return (None, None)
# Alternate subcategory passed in isn't mapped to a category/subcategory
raise ValueError(f"Unmapped alternate subcategory: {typed_alt_subcat}")
The current implementation of
category_correspondenceconsists of a series of if-statements checking for membership in lists, but then falls back to a default(None, None)value intended for when the alternate subcategory is Beliefs or Practices:But if an alternate subcategory not covered by the if-statements is passed, it will also return
(None, None), which is potentially undesired behavior as it conflates an unmapped value with the expected output of beliefs or practices.I would suggest changing this so it raises an error if an alternate subcategory isn't explicitly mapped to a category or subcategory.