Skip to content

Map value when single value provided for multivalued slot. #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

martinwellman
Copy link
Collaborator

In ObjectTransformer's map_object function, if a single-valued value is provided but the source slot is multi-valued, then previously the value was converted to a list without mapping the value:

v = [v]

The desired behaviour is to both convert the single value to a list and also map that single value:

v = [self.map_object(v, source_class_slot_range, target_range)]

Closes #59

@nlharris
Copy link

I'm not the right person to review this, and Chris is a PI and shouldn't be asked to review PRs (though of course he may volunteer himself!). I suggest @kevinschaper as a reviewer.

@kevinschaper
Copy link
Contributor

@martinwellman Would you be willing to add a unit test that captures the failure here?

I'm a little hesitant to ask, because this code is deeply nested enough that it really can't be "unit" tested, and solving that is obviously way out of scope for this PR, but this seems like the sort of miss that it would be nice to ensure we don't repeat.

Copy link
Contributor

@kevinschaper kevinschaper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving because it's a good/important fix, but not merging yet just in case @martinwellman has time to add a test too

@martinwellman
Copy link
Collaborator Author

martinwellman commented Jun 13, 2025

@martinwellman Would you be willing to add a unit test that captures the failure here?

I'm a little hesitant to ask, because this code is deeply nested enough that it really can't be "unit" tested, and solving that is obviously way out of scope for this PR, but this seems like the sort of miss that it would be nice to ensure we don't repeat.

@kevinschaper I'll try to add a unit test for this next week.

@cmungall
Copy link
Member

cmungall commented Jun 16, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Single-valued values that belong to a multivalued slot in the source class do not get mapped
4 participants