def test_test(self): d = self.document self.assertTrue(jp.apply_patch(d, jp.Patch(op="test", path="/age"))) self.assertTrue(jp.apply_patch(d, jp.Patch(op="test", path="/age", value=31))) self.assertFalse(jp.apply_patch(d, jp.Patch(op="test", path="/age", value=32))) self.assertFalse(jp.apply_patch(d, jp.Patch(op="test", path="/hamburger_count"))) self.assertFalse(jp.apply_patch(d, jp.Patch(op="test", path="/hamburger_count", value="the, all of")))
def apply_patch(self, patch): jp.apply_patch(self.document, patch) return self.document