code: def test_rule():
      console = Console(
          width=16,
          file=io.StringIO(),
          force_terminal=True,
          legacy_windows=False,
          _environ={},
      )
      console.print(Rule())
      console.print(Rule("foo"))
      console.rule(Text("foo", style="bold"))
      console.rule("foobarbazeggfoobarbazegg")
      expected = "\x1b[92m────────────────\x1b[0m\n"
      expected += "\x1b[92m───── \x1b[0mfoo\x1b[92m ──────\x1b[0m\n"
      expected += "\x1b[92m───── \x1b[0m\x1b[1mfoo\x1b[0m\x1b[92m ──────\x1b[0m\n"
      expected += "\x1b[92m─ \x1b[0mfoobarbazeg…\x1b[92m ─\x1b[0m\n"
  
      result = console.file.getvalue()
      assert result == expected
  
file_path: rich/tests/test_rule.py
imports: import io
  import pytest
  from rich.console import Console
  from rich.rule import Rule
  from rich.text import Text
label_desc: Use image node_id 1 for calling a global function with example usage: test_rule() without return types