citation-file-format / cffconvert

Command line program to validate and convert CITATION.cff files.
Apache License 2.0
100 stars 28 forks source link

Review how author behaves given different keys in SchemaAuthorShared #300

Closed jspaaks closed 1 year ago

jspaaks commented 1 year ago

It seems there may be small errors in the mapping of behavior from keys. For example,

https://github.com/citation-file-format/cff-converter-python/blob/45126d07c5866674d438c0c905dc2c76fb0a15af/cffconvert/behavior_shared/schemaorg_author_shared.py#L22

should map to self._from_given_and_last because the cff can't be valid with both the properties of an EntityAuthor (name) and a PersonAuthor (family-names, given-names).

Not sure if fixing this would affect the major version number, because the wrong behavior should be unreachable for valid CITATION.cff files, and validation happens even without the --validate flag when converting.

While fixing this issue, maybe also add tests to check the keys used in self._behaviors cover the possible permutations and the dictionary has the right length. The permutations test could be a parameterized test that simply checks if its value is not None.

jspaaks commented 1 year ago

Behavior was fixed in PR #309, but some tests could still be added so leaving this open for now.

jspaaks commented 1 year ago

Tests were added in PR #317, closing this issue