Skip to content

Use deep copy for nested schema expectations in test_schema_dumper.py #1828

Open

Description

@coderabbitai

Summary

In tests/unit/utils/test_schema_dumper.py, the test test_no_change_for_simple_object (and potentially other tests) uses original.copy() (a shallow copy) to create the expected dict. Since the schema dicts contain nested structures (e.g., properties), a shallow copy will not protect against unintended in-place nested mutations, making the test unreliable for detecting such bugs.

Suggested Fix

Replace original.copy() with copy.deepcopy(original) and add the required import at the top of the file:

from copy import deepcopy

Then update the assignment:

expected = deepcopy(original)

This change should be applied wherever original.copy() is used for nested dicts in the test file.

References

/cc @tisnik

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions