          response = denied_object_view_with_detail(self.request, pk=1)
          detail = response.data.get('detail')
          self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
          self.assertEqual(detail, self.custom_message)
  
  
  class PermissionsCompositionTests(TestCase):
  
      def setUp(self):
 
</s>
        self.assertEqual(detail.code, self.custom_code)
          response = denied_object_view_with_detail(self.request, pk=1)
          detail = response.data.get('detail')
          self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
          self.assertEqual(detail, self.custom_message)
        self.assertEqual(detail.code, self.custom_code)
  
  
  class PermissionsCompositionTests(TestCase):
  
      def setUp(self):
keep keep keep add keep keep keep keep keep
 Pass custom code to PermissionDenied if permission class had one set (#7306)
tests/test_permissions.py