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

Getting Pydantic serializer warnings when running MetaKB tests #458

Closed
korikuzma opened this issue Jan 21, 2025 · 0 comments · Fixed by #461
Closed

Getting Pydantic serializer warnings when running MetaKB tests #458

korikuzma opened this issue Jan 21, 2025 · 0 comments · Fixed by #461
Assignees
Labels
bug Something isn't working priority:low Low priority

Comments

@korikuzma
Copy link
Member

Describe the bug

When running MetaKB tests, I'm getting the following:

metakb/venv/lib/python3.11/site-packages/pydantic/main.py:426: UserWarning: Pydantic serializer warnings:
    Expected `enum` but got `str` with value `'RxNorm'` - serialized value may not be as expected
    Expected `enum` but got `str` with value `'NCIt'` - serialized value may not be as expected
    Expected `enum` but got `str` with value `'HemOnc'` - serialized value may not be as expected
    Expected `enum` but got `str` with value `'DrugBank'` - serialized value may not be as expected
    Expected `enum` but got `str` with value `'GuideToPHARMACOLOGY'` - serialized value may not be as expected
    Expected `enum` but got `str` with value `'ChEMBL'` - serialized value may not be as expected
    Expected `enum` but got `str` with value `'ChemIDplus'` - serialized value may not be as expected
    Expected `enum` but got `str` with value `'Wikidata'` - serialized value may not be as expected

Steps to reproduce

In MetaKB, run transformers tests (python3 -m pytest tests/unit/transformers -vv). I'm currently using issue-240 branch, but could use staging too.

Expected behavior

I do not expect to see any Pydantic serializer warnings

Current behavior

I see Pydantic serializer warnings

Acceptance Criteria

Given I'm running MetaKB transformer tests,
When I see the warnings summary in the terminal,
Then I will not see any Pydantic serializer warnings

Possible reason(s)

source_matches has type dict[SourceName, MatchesNormalized], but it's actually be used as dict[str, MatchesNormalized]

Suggested fix

No response

Branch, commit, and/or version

v0.7.1

Screenshots

No response

Environment details

NA

Additional details

No response

Contribution

Yes, I can create a PR for this fix.

@korikuzma korikuzma added bug Something isn't working priority:low Low priority labels Jan 21, 2025
@korikuzma korikuzma self-assigned this Jan 21, 2025
korikuzma added a commit that referenced this issue Jan 30, 2025
close #458

* `source_meta` key should have type `SourceName` not `str`
korikuzma added a commit that referenced this issue Jan 30, 2025
close #458

* `source_meta` key should have type `SourceName` not `str`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:low Low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant