code: def test_unpickle_previous_python_versions(self):
      def check(actual, expected):
          self.assertEqual(actual, expected)
          self.assertEqual(actual.is_safe, expected.is_safe)
  
      pickled_uuids = [
          # Python 2.7, protocol 0
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR(dS'int'\nL287307832597519156748809049798316161701L\nsb.",
          # Python 2.7, protocol 1
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR}U\x03intL287307832597519156748809049798316161701L\nsb.",
          # Python 2.7, protocol 2
          b"\x80\x02cuuid\nUUID\n)\x81}U\x03int\x8a\x11\xa5z\xecz\nI\xdf}"
          b"\xde\xa0Bf\xcey%\xd8\x00sb.",
          # Python 3.6, protocol 0
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR(dVint\nL287307832597519156748809049798316161701L\nsb.",
          # Python 3.6, protocol 1
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR}X\x03\x00\x00\x00intL287307832597519156748809049798316161701L"
          b"\nsb.",
          # Python 3.6, protocol 2
          b"\x80\x02cuuid\nUUID\n)\x81}X\x03\x00\x00\x00int\x8a\x11\xa5z\xec"
          b"z\nI\xdf}\xde\xa0Bf\xcey%\xd8\x00sb.",
          # Python 3.6, protocol 3
          b"\x80\x03cuuid\nUUID\n)\x81}X\x03\x00\x00\x00int\x8a\x11\xa5z\xec"
          b"z\nI\xdf}\xde\xa0Bf\xcey%\xd8\x00sb.",
          # Python 3.6, protocol 4
          b"\x80\x04\x95+\x00\x00\x00\x00\x00\x00\x00\x8c\x04uuid\x8c\x04UUI"
          b"D\x93)\x81}\x8c\x03int\x8a\x11\xa5z\xecz\nI\xdf}\xde\xa0Bf\xcey%"
          b"\xd8\x00sb.",
          # Python 3.7, protocol 0
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR(dVint\nL287307832597519156748809049798316161701L\nsVis_safe\n"
          b"cuuid\nSafeUUID\n(NtRsb.",
          # Python 3.7, protocol 1
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR}(X\x03\x00\x00\x00intL287307832597519156748809049798316161701"
          b"L\nX\x07\x00\x00\x00is_safecuuid\nSafeUUID\n(NtRub.",
          # Python 3.7, protocol 2
          b"\x80\x02cuuid\nUUID\n)\x81}(X\x03\x00\x00\x00int\x8a\x11\xa5z"
          b"\xecz\nI\xdf}\xde\xa0Bf\xcey%\xd8\x00X\x07\x00\x00\x00is_safecuu"
          b"id\nSafeUUID\nN\x85Rub.",
          # Python 3.7, protocol 3
          b"\x80\x03cuuid\nUUID\n)\x81}(X\x03\x00\x00\x00int\x8a\x11\xa5z"
          b"\xecz\nI\xdf}\xde\xa0Bf\xcey%\xd8\x00X\x07\x00\x00\x00is_safecuu"
          b"id\nSafeUUID\nN\x85Rub.",
          # Python 3.7, protocol 4
          b"\x80\x04\x95F\x00\x00\x00\x00\x00\x00\x00\x8c\x04uuid\x94\x8c"
          b"\x04UUID\x93)\x81}(\x8c\x03int\x8a\x11\xa5z\xecz\nI\xdf}\xde\xa0"
          b"Bf\xcey%\xd8\x00\x8c\x07is_safeh\x00\x8c\x08SafeUUID\x93N\x85Rub"
          b".",
      ]
      pickled_uuids_safe = [
          # Python 3.7, protocol 0
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR(dVint\nL287307832597519156748809049798316161701L\nsVis_safe\n"
          b"cuuid\nSafeUUID\n(I0\ntRsb.",
          # Python 3.7, protocol 1
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR}(X\x03\x00\x00\x00intL287307832597519156748809049798316161701"
          b"L\nX\x07\x00\x00\x00is_safecuuid\nSafeUUID\n(K\x00tRub.",
          # Python 3.7, protocol 2
          b"\x80\x02cuuid\nUUID\n)\x81}(X\x03\x00\x00\x00int\x8a\x11\xa5z"
          b"\xecz\nI\xdf}\xde\xa0Bf\xcey%\xd8\x00X\x07\x00\x00\x00is_safecuu"
          b"id\nSafeUUID\nK\x00\x85Rub.",
          # Python 3.7, protocol 3
          b"\x80\x03cuuid\nUUID\n)\x81}(X\x03\x00\x00\x00int\x8a\x11\xa5z"
          b"\xecz\nI\xdf}\xde\xa0Bf\xcey%\xd8\x00X\x07\x00\x00\x00is_safecuu"
          b"id\nSafeUUID\nK\x00\x85Rub.",
          # Python 3.7, protocol 4
          b"\x80\x04\x95G\x00\x00\x00\x00\x00\x00\x00\x8c\x04uuid\x94\x8c"
          b"\x04UUID\x93)\x81}(\x8c\x03int\x8a\x11\xa5z\xecz\nI\xdf}\xde\xa0"
          b"Bf\xcey%\xd8\x00\x8c\x07is_safeh\x00\x8c\x08SafeUUID\x93K\x00"
          b"\x85Rub.",
      ]
      pickled_uuids_unsafe = [
          # Python 3.7, protocol 0
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR(dVint\nL287307832597519156748809049798316161701L\nsVis_safe\n"
          b"cuuid\nSafeUUID\n(I-1\ntRsb.",
          # Python 3.7, protocol 1
          b"ccopy_reg\n_reconstructor\n(cuuid\nUUID\nc__builtin__\nobject\nN"
          b"tR}(X\x03\x00\x00\x00intL287307832597519156748809049798316161701"
          b"L\nX\x07\x00\x00\x00is_safecuuid\nSafeUUID\n(J\xff\xff\xff\xfftR"
          b"ub.",
          # Python 3.7, protocol 2
          b"\x80\x02cuuid\nUUID\n)\x81}(X\x03\x00\x00\x00int\x8a\x11\xa5z"
          b"\xecz\nI\xdf}\xde\xa0Bf\xcey%\xd8\x00X\x07\x00\x00\x00is_safecuu"
          b"id\nSafeUUID\nJ\xff\xff\xff\xff\x85Rub.",
          # Python 3.7, protocol 3
          b"\x80\x03cuuid\nUUID\n)\x81}(X\x03\x00\x00\x00int\x8a\x11\xa5z"
          b"\xecz\nI\xdf}\xde\xa0Bf\xcey%\xd8\x00X\x07\x00\x00\x00is_safecuu"
          b"id\nSafeUUID\nJ\xff\xff\xff\xff\x85Rub.",
          # Python 3.7, protocol 4
          b"\x80\x04\x95J\x00\x00\x00\x00\x00\x00\x00\x8c\x04uuid\x94\x8c"
          b"\x04UUID\x93)\x81}(\x8c\x03int\x8a\x11\xa5z\xecz\nI\xdf}\xde\xa0"
          b"Bf\xcey%\xd8\x00\x8c\x07is_safeh\x00\x8c\x08SafeUUID\x93J\xff"
          b"\xff\xff\xff\x85Rub.",
      ]
  
      u = self.uuid.UUID("d82579ce6642a0de7ddf490a7aec7aa5")
      u_safe = self.uuid.UUID(
          "d82579ce6642a0de7ddf490a7aec7aa5",
          is_safe=self.uuid.SafeUUID.safe,
      )
      u_unsafe = self.uuid.UUID(
          "d82579ce6642a0de7ddf490a7aec7aa5",
          is_safe=self.uuid.SafeUUID.unsafe,
      )
  
      with support.swap_item(sys.modules, "uuid", self.uuid):
          for pickled in pickled_uuids:
              # is_safe was added in 3.7.  When unpickling values from older
              # versions, is_safe will be missing, so it should be set to
              # SafeUUID.unknown.
              check(pickle.loads(pickled), u)
          for pickled in pickled_uuids_safe:
              check(pickle.loads(pickled), u_safe)
          for pickled in pickled_uuids_unsafe:
              check(pickle.loads(pickled), u_unsafe)
  
imports: import unittest
  from test import support
  from test.support import import_helper
  import builtins
  import contextlib
  import copy
  import enum
  import io
  import os
  import pickle
  import sys
  import weakref
  from unittest import mock
label_desc: Use image node_id 6 for calling the BaseTestUUID obj's underlying member method code with example usage: obj.test_unpickle_previous_python_versions() without return types