code: def test_boolean_context_compat(index):
      # GH#7897
      with pytest.raises(ValueError, match="The truth value of a"):
          if index:
              pass
  
      with pytest.raises(ValueError, match="The truth value of a"):
          bool(index)
  
imports: import re
  import numpy
  import pytest
  from pandas.errors import InvalidIndexError
  import pandas._testing
label_desc: Use image node_id 1 for calling a global function with example usage: test_boolean_context_compat(index) without return types