      with doc.retokenize() as retokenizer:
          attrs = {"lemma": "hello world", "_": {"a": True, "b": "1"}}
          retokenizer.merge(doc[0:2], attrs=attrs)
      assert doc[0].lemma_ == "hello world"
      assert doc[0]._.a == True
      assert doc[0]._.b == "1"
      # Test bulk merging
      doc = Doc(en_vocab, words=["hello", "world", "!", "!"])
      with doc.retokenize() as retokenizer:
          retokenizer.merge(doc[0:2], attrs={"_": {"a": True, "b": "1"}})
 
</s> remove     assert doc[1]._.a == None
 </s> add     assert doc[1]._.a is None </s> remove     assert doc[0]._.a == True
 </s> add     assert doc[0]._.a is True
    assert doc[0]._.a is True
      with doc.retokenize() as retokenizer:
          attrs = {"lemma": "hello world", "_": {"a": True, "b": "1"}}
          retokenizer.merge(doc[0:2], attrs=attrs)
      assert doc[0].lemma_ == "hello world"
    assert doc[0]._.a is True
      assert doc[0]._.b == "1"
      # Test bulk merging
      doc = Doc(en_vocab, words=["hello", "world", "!", "!"])
      with doc.retokenize() as retokenizer:
          retokenizer.merge(doc[0:2], attrs={"_": {"a": True, "b": "1"}})
keep keep keep keep replace keep keep keep keep keep
 Tidy up tests [ci skip] 
spacy/tests/doc/test_retokenize_merge.py