code: def test_compression(path=None):
      fname = op.join(path, "test.json.xz")
      content = "dummy"
      # dump compressed
      dump(content, fname, compressed=True)
      # filename extension match auto-enabled compression "detection"
      eq_(load(fname), content)
      # but was it actually compressed?
      # we don't care how exactly it blows up (UnicodeDecodeError, etc),
      # but it has to blow
      assert_raises(Exception, load, fname, compressed=False)
  
file_path: datalad/datalad/support/tests/test_json_py.py
imports: import logging
  import os.path
  from json import JSONDecodeError
  from datalad.support.json_py import dump, dump2stream, load, load_stream, loads
  from datalad.tests.utils_pytest import assert_in, assert_raises, eq_, swallow_logs, with_tempfile
label_desc: Use image node_id 4 for calling a global function with example usage: test_compression(path) without return types