code: def test_surrogates(self):
      scanstring = json.decoder.scanstring
  
      def assertScan(given, expect, test_utf8=True):
          givens = [given]
          if not PY3 and test_utf8:
              givens.append(given.encode("utf8"))
          for given in givens:
              (res, count) = scanstring(given, 1, None, True)
              self.assertEqual(len(given), count)
              self.assertEqual(res, expect)
  
      assertScan('"z\\ud834\\u0079x"', "z\ud834yx")
      assertScan('"z\\ud834\\udd20x"', "z\U0001d120x")
      assertScan('"z\\ud834\\ud834\\udd20x"', "z\ud834\U0001d120x")
      assertScan('"z\\ud834x"', "z\ud834x")
      assertScan('"z\\udd20x"', "z\udd20x")
      assertScan('"z\ud834x"', "z\ud834x")
      # It may look strange to join strings together, but Python is drunk.
      # https://gist.github.com/etrepum/5538443
      assertScan(
          '"z\\ud834\udd20x12345"', "".join(["z\ud834", "\udd20x12345"])
      )
      assertScan('"z\ud834\\udd20x"', "".join(["z\ud834", "\udd20x"]))
      # these have different behavior given UTF8 input, because the surrogate
      # pair may be joined (in maxunicode > 65535 builds)
      assertScan(
          "".join(['"z\ud834', '\udd20x"']),
          "".join(["z\ud834", "\udd20x"]),
          test_utf8=False,
      )
  
      self.assertRaises(
          ValueError, scanstring, '"z\\ud83x"', 1, None, True
      )
      self.assertRaises(
          ValueError, scanstring, '"z\\ud834\\udd2x"', 1, None, True
      )
  
file_path: catboost/contrib/python/simplejson/py3/simplejson/tests/test_scanstring.py
imports: import sys
  from unittest import TestCase
  import simplejson
  import simplejson.decoder
  from simplejson.compat import b, PY3
label_desc: Use image node_id 6 for calling the TestScanString obj's underlying member method code with example usage: obj.test_surrogates() without return types