          }
          encoded = signing.dumps(value)
          self.assertEqual(value, signing.loads(encoded))
          for transform in transforms:
              self.assertRaises(
                  signing.BadSignature, signing.loads, transform(encoded))
  
      def test_works_with_non_ascii_keys(self):
          binary_key = b'\xe7'  # Set some binary (non-ASCII key)
  
          s = signing.Signer(binary_key)
 
</s> remove             self.assertRaises(
                signing.BadSignature, signer.unsign, transform(signed_value))
 </s> add             with self.assertRaises(signing.BadSignature):
                signer.unsign(transform(signed_value)) </s> remove         self.assertRaises(signing.BadSignature,
            request.get_signed_cookie, 'a', salt='two')
 </s> add         with self.assertRaises(signing.BadSignature):
            request.get_signed_cookie('a', salt='two') </s> remove         self.assertRaises(AttributeError, shortcut, request, user_ct.id, obj.id)
 </s> add         with self.assertRaises(AttributeError):
            shortcut(request, user_ct.id, obj.id) </s> remove         self.assertRaises(ObjectDoesNotExist, Site.objects.get_current)
 </s> add         with self.assertRaises(ObjectDoesNotExist):
            Site.objects.get_current() </s> remove         self.assertRaises(ContentNotRenderedError,
                          pickle.dumps, response)
 </s> add         with self.assertRaises(ContentNotRenderedError):
            pickle.dumps(response)
            with self.assertRaises(signing.BadSignature):
                signing.loads(transform(encoded))
          }
          encoded = signing.dumps(value)
          self.assertEqual(value, signing.loads(encoded))
          for transform in transforms:
            with self.assertRaises(signing.BadSignature):
                signing.loads(transform(encoded))
            with self.assertRaises(signing.BadSignature):
                signing.loads(transform(encoded))
  
      def test_works_with_non_ascii_keys(self):
          binary_key = b'\xe7'  # Set some binary (non-ASCII key)
  
          s = signing.Signer(binary_key)
keep keep keep keep replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/signing/tests.py