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

Add tests for serialization with internal ids forscript.evaluate and script.callFunction. #36041

Closed

Conversation

lutien
Copy link
Contributor

@lutien lutien commented Sep 23, 2022

The code is already reviewed in Mozilla repo.

@sadym-chromium
Copy link
Contributor

sadym-chromium commented Sep 23, 2022

Chromium doesn't support internal IDs yet, and not sure when will. Can the tests be moved to something like internal_ids.py file?

Copy link
Contributor

@sadym-chromium sadym-chromium left a comment

Choose a reason for hiding this comment

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

Amazing, thanks!

["bar", {"type": type, "internalId": any_string}],
]

recursive_compare({"type": result_type, "value": value}, result)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to check the return type here? It looks like comparing the value will enough. Can simplify the test, and check only the internal IDs, without data types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, the result_type is not really important here, I've removed it, but I think it is still good to check that the type is present in the value with internalId

Copy link
Contributor

Choose a reason for hiding this comment

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

It can be removed from the parameters as well them


if result_type == "array":
value = [
{"type": type, "internalId": any_string},
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to check one of the items actually have the value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The value is actually not present here, since we serialize only with maxDepth=1 now

Copy link
Contributor

@sadym-chromium sadym-chromium left a comment

Choose a reason for hiding this comment

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

Just one nit comment


@pytest.mark.asyncio
@pytest.mark.parametrize(
"return_structure, result_type",
Copy link
Contributor

Choose a reason for hiding this comment

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

result_type can be removed from here now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lutien
Copy link
Contributor Author

lutien commented Sep 23, 2022

@sadym-chromium, thanks a lot for the quick review!
Going to close this PR now, it will be synced from Mozilla repo.

@lutien lutien closed this Sep 23, 2022
@lutien lutien deleted the add-bidi-test-for-internalId branch September 23, 2022 13:48
@whimboo
Copy link
Contributor

whimboo commented Sep 23, 2022

FYI I also requested an additional test that actually checks that the generated internalIds are unique.

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

Successfully merging this pull request may close these issues.

None yet

5 participants