|
| 1 | +from copy import deepcopy |
1 | 2 | from deepdiff.summarize import summarize, _truncate
|
2 | 3 |
|
3 | 4 |
|
@@ -105,18 +106,22 @@ def test_nested_structure_summary1(self):
|
105 | 106 | }
|
106 | 107 | ]
|
107 | 108 | }
|
108 |
| - summary = summarize(data, max_length=200) |
| 109 | + data_copy = deepcopy(data) |
| 110 | + summary = summarize(data_copy, max_length=200) |
109 | 111 | assert len(summary) <= 200
|
110 | 112 | # Check that some expected keys are in the summary
|
111 | 113 | assert '"RecordType"' in summary
|
112 | 114 | assert '"RecordNumber"' in summary
|
113 | 115 | assert '"RecordTitle"' in summary
|
114 | 116 | assert '{"RecordType":,"RecordNumber":,"RecordTitle":","Section":[{"TOCHeading":","Description":"St...d","Section":[{"TOCHeading":","Description":"A t,"DisplayControls":{"Information":[{}]},...]},...]}' == summary
|
| 117 | + assert data_copy == data, "We should not have modified the original data" |
115 | 118 |
|
116 | 119 | def test_nested_structure_summary2(self, compounds):
|
117 | 120 | summary = summarize(compounds, max_length=200)
|
118 | 121 | assert len(summary) <= 200
|
| 122 | + data_copy = deepcopy(compounds) |
119 | 123 | assert '{"RecordType":,"RecordNumber":,"RecordTitle":,"Section":[{"TOCHeading":,"Description":"Stru,"Section":[{"TOCHeading":"2D S,"DisplayControls":{}},...]},...],"Reference":[{},...]}' == summary
|
| 124 | + assert data_copy == compounds, "We should not have modified the original data" |
120 | 125 |
|
121 | 126 | def test_list_summary(self):
|
122 | 127 | data = [1, 2, 3, 4]
|
|
0 commit comments