Skip to content

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

@coderabbitai

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions