python-json-patch icon indicating copy to clipboard operation
python-json-patch copied to clipboard

Add option to generate `test` operations in diff

Open RobertCochran opened this issue 1 year ago • 1 comments

Hi,

This PR adds a new option for generating patches - generate_test_ops - that adds a test operation before every remove and replace operation. This allows for generating patches that have stronger data integrity characteristics. It is also a useful option if you care about knowing what the data was pre-patch (this is important for our use-case). The flag defaults to False to keep the default behavior the same.

I have modified the test suite to run the MakePatchTestCase twice - once with generate_test_ops=True and once with generate_test_ops=False. Patches are still applying properly in both cases so I am confident that all is well.

Please let me know if there's anything else that needs to be done as part of this PR.

Thanks!

RobertCochran avatar Jan 17 '24 17:01 RobertCochran

Hi, any news on this?

RobertCochran avatar Mar 25 '24 20:03 RobertCochran

Hi, checking in on this. Is there anything that needs to be done to get this merged?

RobertCochran avatar Oct 29 '25 19:10 RobertCochran