File .deepsource.toml
not found in the default branch of the repository root. Please refer to the docs.
True
should be expr is True
84 stripe_connector = PAYMENT_PROVIDER_MAP[PAYMENT_PROVIDERS.STRIPE]
85 stripe_connector.initialize_settings(setup_dict["org"])
86 # when self hosted make sure everything works
87 assert SELF_HOSTED == True 88 assert stripe_connector.working()
89 assert stripe_connector.organization_connected(setup_dict["org"])
90
False
should be expr is False
205 organization=setup_dict["org"],
206 )
207
208 assert stripe_sub.cancel_at_period_end == False209 stripe_connector.transfer_subscriptions(setup_dict["org"], end_now=False)
210
211 time.sleep(10)
True
should be expr is True
210
211 time.sleep(10)
212 stripe_sub = stripe.Subscription.retrieve(stripe_sub.id)
213 assert stripe_sub.cancel_at_period_end == True214 assert (
215 Subscription.objects.filter(
216 organization=setup_dict["org"],
False
should be expr is False
198 )
199 assert (
200 response[0]["metric_usage"] < response[0]["metric_total_limit"]
201 ) == False202
203 def test_get_access_free_bm_allow(self, get_access_test_common_setup):
204 setup_dict = get_access_test_common_setup(auth_method="api_key")
False
should be expr is False
231 assert (
232 response[0]["event_name"] == setup_dict["allow_limit_metrics"][0].event_name
233 )
234 assert (response[0]["metric_usage"] < response[0]["metric_free_limit"]) == False235
236 def test_get_access_feature_allow(self, get_access_test_common_setup):
237 setup_dict = get_access_test_common_setup(auth_method="api_key")
Comparisons to the singleton objects, like True
, False
, and None
, should be done with identity, not equality. Use is
or is not
.
Identity checks are faster than equality checks.
Also, the equality checks can result in unintended behaviour in some cases:
>>> 1 is True
False
>>> 1 == True
True
>>> 1.0 is True
False
>>> 1.0 == True
True
value = fx()
if value == True: # `==` can cause unintended behaviour
print(value)
if value != None:
print(value)
value = fx()
if value is True: # `is` for Identity comparison
print(value)
if value is not None:
print(value)
Equality comparisons might be required in some cases, especially in SQLAlchemy, SQLObject, ORMs, etc. In these cases, it is safe to ignore this issue.