code: def test_span_ruler_serialize_bytes(patterns):
      nlp = spacy.blank("xx")
      ruler = nlp.add_pipe("span_ruler")
      ruler.add_patterns(patterns)
      assert len(ruler) == len(patterns)
      assert len(ruler.labels) == 4
      ruler_bytes = ruler.to_bytes()
      new_nlp = spacy.blank("xx")
      new_ruler = new_nlp.add_pipe("span_ruler")
      assert len(new_ruler) == 0
      assert len(new_ruler.labels) == 0
      new_ruler = new_ruler.from_bytes(ruler_bytes)
      assert len(new_ruler) == len(patterns)
      assert len(new_ruler.labels) == 4
      assert len(new_ruler.patterns) == len(ruler.patterns)
      for pattern in ruler.patterns:
          assert pattern in new_ruler.patterns
      assert sorted(new_ruler.labels) == sorted(ruler.labels)
  
imports: import pytest
  from thinc.api import NumpyOps, get_current_ops
  import spacy
  from spacy import registry
  from spacy.errors import MatchPatternError
  from spacy.tests.util import make_tempdir
  from spacy.tokens import Span
  from spacy.training import Example
label_desc: Use image node_id 13 for calling a global function with example usage: test_span_ruler_serialize_bytes(patterns) without return types