Skip to content

Conversation

bblommers
Copy link
Contributor

The existing match() function expects a dictionary. But when writing tests for a certain other SDK, it returns objects instead of dictionaries. So it would be nice to have an option to serialize random objects as well, without having to care about the exact format.

An alternative implementation to get the same functionality would be to add this to the match() function:

def match(self, key: str, obj: object) -> None:
    # Transform incoming object to a dictionary
    obj: dict = _convert_object_to_dict(obj)

    ...

I have no preference either way - I just picked the least invasive change, to avoid breaking the existing functionality in some unknown way.

@thrau thrau requested a review from steffyP April 1, 2024 20:03
Copy link
Member

@steffyP steffyP left a comment

Choose a reason for hiding this comment

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

Nice work 🚀 Thanks for adding this addition @bblommers 🙏

The changes LGTM!

just picked the least invasive change, to avoid breaking the existing functionality in some unknown way

That's very thoughtful! I also prefer it this way 🙂

@bblommers bblommers force-pushed the feature-allow-matching-objects branch from b3033c7 to 059a981 Compare April 24, 2024 12:32
@thrau thrau merged commit b0cd665 into main Apr 24, 2024
@thrau thrau deleted the feature-allow-matching-objects branch April 24, 2024 22:20
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.

3 participants