Skip to content
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

validate_expected_files_by_modality fails when called on valid files through .model_validate #1205

Open
dbirman opened this issue Jan 3, 2025 · 0 comments

Comments

@dbirman
Copy link
Member

dbirman commented Jan 3, 2025

Describe the bug
The function validate_expected_files_by_modality fails because validated models generated from dictionaries don't recover Modality objects but instead recover a list of dictionaries.

To Reproduce
Steps to reproduce the behavior:

  1. Load any valid metadata as a dict
  2. Run Metadata.model_validate(dict)
    abbreviation = modality.abbreviation.replace("-", "_").upper()
                   ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'abbreviation'

Expected behavior
The function shouldn't crash on modality.abbreviation but should check if modality is a dict and use modality["abbreviation"] instead.

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

No branches or pull requests

1 participant