code: def test_on_bad_lines_warn_correct_formatting(all_parsers):
      # see gh-15925
      parser = all_parsers
      data = """1,2
  a,b
  a,b,c
  a,b,d
  a,b
  """
      expected = DataFrame({"1": "a", "2": ["b"] * 2})
      match_msg = "Skipping line"
  
      expected_warning = ParserWarning
      if parser.engine == "pyarrow":
          match_msg = "Expected 2 columns, but found 3: a,b,c"
          expected_warning = (ParserWarning, DeprecationWarning)
  
      with tm.assert_produces_warning(
          expected_warning, match=match_msg, check_stacklevel=False
      ):
          result = parser.read_csv(StringIO(data), on_bad_lines="warn")
      tm.assert_frame_equal(result, expected)
  
imports: import codecs
  import csv
  from io import StringIO
  import os
  from pathlib import Path
  import numpy
  import pytest
  from pandas.compat import PY311
  from pandas.errors import EmptyDataError, ParserError, ParserWarning
  from pandas import DataFrame
  import pandas._testing
label_desc: Use image node_id 16 for calling a global function with example usage: test_on_bad_lines_warn_correct_formatting(all_parsers) without return types