code: def test_bytes_key(self):
      self.assertEqual(
          json.dumps({b("\xe2\x82\xac"): 42}), r'{"\u20ac": 42}'
      )
      self.assertRaises(UnicodeDecodeError, json.dumps, {b("\xa4"): 42})
      self.assertEqual(
          json.dumps({b("\xa4"): 42}, encoding="iso-8859-1"),
          r'{"\u00a4": 42}',
      )
      self.assertEqual(
          json.dumps({b("\xa4"): 42}, encoding="iso-8859-15"),
          r'{"\u20ac": 42}',
      )
      if PY3:
          self.assertRaises(
              TypeError,
              json.dumps,
              {b("\xe2\x82\xac"): 42},
              encoding=None,
          )
          self.assertRaises(
              TypeError, json.dumps, {b("\xa4"): 42}, encoding=None
          )
          self.assertRaises(
              TypeError,
              json.dumps,
              {b("\xa4"): 42},
              encoding=None,
              default=decode_iso_8859_15,
          )
          self.assertEqual(
              json.dumps({b("\xa4"): 42}, encoding=None, skipkeys=True),
              r"{}",
          )
      else:
          self.assertEqual(
              json.dumps({b("\xe2\x82\xac"): 42}, encoding=None),
              r'{"\u20ac": 42}',
          )
          self.assertRaises(
              UnicodeDecodeError,
              json.dumps,
              {b("\xa4"): 42},
              encoding=None,
          )
          self.assertRaises(
              UnicodeDecodeError,
              json.dumps,
              {b("\xa4"): 42},
              encoding=None,
              default=decode_iso_8859_15,
          )
          self.assertRaises(
              UnicodeDecodeError,
              json.dumps,
              {b("\xa4"): 42},
              encoding=None,
              skipkeys=True,
          )
  
imports: from unittest import TestCase
  from simplejson.compat import StringIO, long_type, b, binary_type, text_type, PY3
  import simplejson
label_desc: Use image node_id 14 for calling the TestDump obj's underlying member method code with example usage: obj.test_bytes_key() without return types