code: def test_escape():
      # Potential tags
      assert escape("foo[bar]") == r"foo\[bar]"
      assert escape(r"foo\[bar]") == r"foo\\\[bar]"
  
      # Not tags (escape not required)
      assert escape("[5]") == "[5]"
      assert escape("\\[5]") == "\\[5]"
  
      # Test @ escape
      assert escape("[@foo]") == "\\[@foo]"
      assert escape("[@]") == "\\[@]"
  
      # https://github.com/Textualize/rich/issues/2187
      assert escape("[nil, [nil]]") == r"[nil, \[nil]]"
  
imports: import pytest
  from rich.console import Console
  from rich.errors import MarkupError
  from rich.markup import RE_TAGS, Tag, _parse, escape, render
  from rich.text import Span, Text
label_desc: Use image node_id 3 for calling a global function with example usage: test_escape() without return types