code: def test_invalid_schema(tmpdir):
      tmpdir = str(tmpdir)
      b = db.from_sequence(expected, npartitions=3)
      fn = os.path.join(tmpdir, "out*.avro")
      with pytest.raises(AssertionError):
          b.to_avro(fn, schema=[])
      with pytest.raises(AssertionError):
          b.to_avro(fn, schema={})
      with pytest.raises(AssertionError):
          b.to_avro(fn, schema={"doc": "unknown"})
      with pytest.raises(AssertionError):
          b.to_avro(fn, schema={"name": "test"})
      with pytest.raises(AssertionError):
          b.to_avro(fn, schema={"name": "test", "type": "wrong"})
      with pytest.raises(AssertionError):
          b.to_avro(fn, schema={"name": "test", "type": "record"})
      with pytest.raises(AssertionError):
          b.to_avro(fn, schema={"name": "test", "type": "record"})
      with pytest.raises(AssertionError):
          b.to_avro(
              fn,
              schema={
                  "name": "test",
                  "type": "record",
                  "fields": [{"name": "a"}],
              },
          )
  
file_path: dask/dask/bag/tests/test_avro.py
imports: from __future__ import annotations
  import os
  import random
  import pytest
  import dask.bag
label_desc: Use image node_id 6 for calling a global function with example usage: test_invalid_schema(tmpdir) without return types