Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

typing: Avoid scoped redefinition of different types.

PIG20891de2cbe0364
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index 12a5b5b4be4..139cb2b0f34 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -487,9 +487,9 @@ class StripeTest(StripeTestCase):
raise stripe.error.InvalidRequestError("message", "param", "code", json_body={})
with self.assertLogs("corporate.stripe", "ERROR") as error_log:
- with self.assertRaises(BillingError) as context:
+ with self.assertRaises(BillingError) as billing_context:
raise_invalid_request_error()
- self.assertEqual("other stripe error", context.exception.error_description)
+ self.assertEqual("other stripe error", billing_context.exception.error_description)
self.assertEqual(
error_log.output, ["ERROR:corporate.stripe:Stripe error: None None None None"]
)
@@ -503,10 +503,10 @@ class StripeTest(StripeTestCase):
)
with self.assertLogs("corporate.stripe", "INFO") as info_log:
- with self.assertRaises(StripeCardError) as context:
+ with self.assertRaises(StripeCardError) as card_context:
raise_card_error()
- self.assertIn("not a valid credit card", str(context.exception))
- self.assertEqual("card error", context.exception.error_description)
+ self.assertIn("not a valid credit card", str(card_context.exception))
+ self.assertEqual("card error", card_context.exception.error_description)
self.assertEqual(
info_log.output, ["INFO:corporate.stripe:Stripe card error: None None None None"]
)
diff --git a/zerver/tests/test_decorators.py b/zerver/tests/test_decorators.py
index 5d8470f5a78..06e340d99cf 100644
--- a/zerver/tests/test_decorators.py
+++ b/zerver/tests/test_decorators.py
@@ -179,14 +179,16 @@ class DecoratorTestCase(ZulipTestCase):
self.assertEqual(str(cm.exception), "Bad value for 'numbers': bad_value")
request.POST["numbers"] = orjson.dumps("{fun: unfun}").decode()
- with self.assertRaises(JsonableError) as cm:
+ with self.assertRaises(JsonableError) as jsonable_error_cm:
get_total(request)
- self.assertEqual(str(cm.exception), "Bad value for 'numbers': \"{fun: unfun}\"")
+ self.assertEqual(
+ str(jsonable_error_cm.exception), "Bad value for 'numbers': \"{fun: unfun}\""
+ )
request.POST["numbers"] = orjson.dumps([2, 3, 5, 8, 13, 21]).decode()
- with self.assertRaises(JsonableError) as cm:
+ with self.assertRaises(JsonableError) as jsonable_error_cm:
get_total(request)
- self.assertEqual(str(cm.exception), "13 is an unlucky number!")
+ self.assertEqual(str(jsonable_error_cm.exception), "13 is an unlucky number!")
request.POST["numbers"] = orjson.dumps([1, 2, 3, 4, 5, 6]).decode()
result = get_total(request)
diff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.py
index dd164c765ef..6c22473d0d6 100644
--- a/zerver/tests/test_users.py
+++ b/zerver/tests/test_users.py
@@ -295,7 +295,7 @@ class PermissionTest(ZulipTestCase):
"zerver.lib.events.request_event_queue", return_value=None
) as mock_request_event_queue:
with self.assertRaises(JsonableError):
- result = do_events_register(user, get_client("website"), client_gravatar=True)
+ do_events_register(user, get_client("website"), client_gravatar=True)
self.assertEqual(mock_request_event_queue.call_args_list[0][0][3], True)
#############################################################