code: def test_layer_errors():
      toplevel_chart = (
          alt.Chart("data.txt").mark_point().configure_legend(columns=2)
      )
  
      facet_chart1 = (
          alt.Chart("data.txt").mark_point().encode(facet="row:Q")
      )
  
      facet_chart2 = alt.Chart("data.txt").mark_point().facet("row:Q")
  
      repeat_chart = (
          alt.Chart("data.txt").mark_point().repeat(["A", "B", "C"])
      )
  
      simple_chart = alt.Chart("data.txt").mark_point()
  
      with pytest.raises(ValueError) as err:
          toplevel_chart + simple_chart
      assert str(err.value).startswith(
          'Objects with "config" attribute cannot be used within LayerChart.'
      )
  
      with pytest.raises(ValueError) as err:
          alt.hconcat(simple_chart) + simple_chart
      assert (
          str(err.value)
          == "Concatenated charts cannot be layered. Instead, layer the charts before concatenating."
      )
  
      with pytest.raises(ValueError) as err:
          repeat_chart + simple_chart
      assert (
          str(err.value)
          == "Repeat charts cannot be layered. Instead, layer the charts before repeating."
      )
  
      with pytest.raises(ValueError) as err:
          facet_chart1 + simple_chart
      assert (
          str(err.value)
          == "Faceted charts cannot be layered. Instead, layer the charts before faceting."
      )
  
      with pytest.raises(ValueError) as err:
          alt.layer(simple_chart) + facet_chart2
      assert (
          str(err.value)
          == "Faceted charts cannot be layered. Instead, layer the charts before faceting."
      )
  
imports: import io
  import json
  import operator
  import os
  import pathlib
  import tempfile
  import jsonschema
  import pytest
  import pandas
  import altair.vegalite.v5
label_desc: Use image node_id 37 for calling a global function with example usage: test_layer_errors() without return types