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

test_util: Add test for get_dict_key_from_value #438

Merged
merged 1 commit into from
Aug 10, 2024

Conversation

sonic2kk
Copy link
Contributor

@sonic2kk sonic2kk commented Aug 1, 2024

Adds a test for the get_dict_key_from_value. It is written so it tests dicts with various different values, far more exotic than the couple of uses in the codebase that only test dict[str, str]. Although we do test that case we also test cases with more exotic key types, to allow the test to give us more confidence in this function.

I also updated the type hints in get_dict_key_from_value function itself, although they are mostly Any and basedPyright does not like the Any type by default. Although in this case I think it makes sense, dicts can have pretty much any key and value, so it makes sense that we could give this function a dict of Any and so the value we're searching for (searchval) as well could also be Any.

@DavidoTek DavidoTek merged commit 140f4d7 into DavidoTek:main Aug 10, 2024
1 check passed
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.

2 participants