code: def test_csv_generate_tables_raises_error_with_malformed_csv(
      csv_file, malformed_csv_file, caplog
  ):
      csv = Csv()
      generator = csv._generate_tables([[csv_file, malformed_csv_file]])
      with pytest.raises(ValueError, match="Error tokenizing data"):
          for _ in generator:
              pass
      assert any(
          record.levelname == "ERROR"
          and "Failed to read file" in record.message
          and os.path.basename(malformed_csv_file) in record.message
          for record in caplog.records
      )
  
file_path: datasets/tests/packaged_modules/test_csv.py
imports: import os
  import textwrap
  import pyarrow
  import pytest
  from datasets import ClassLabel, Features, Image
  from datasets.packaged_modules.csv.csv import Csv
  from ..utils import require_pil
label_desc: Use image node_id 6 for calling a global function with example usage: test_csv_generate_tables_raises_error_with_malformed_csv(csv_file, malformed_csv_file, caplog) without return types