diff options
author | deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> | 2021-06-06 10:17:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-06 10:17:27 +0000 |
commit | b40c1104a2a89d2b82f0ce28156c54f0089eb379 (patch) | |
tree | 5fd549c261e1bfc90cb34a51d188b16c1e10838c | |
parent | 62a5ca363415b0f6f98785b6c3522a71fc895a72 (diff) |
Use identity check for comparison to a singleton
-rw-r--r-- | app/apis.py | 2 | ||||
-rw-r--r-- | app/tests/test_models.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/app/apis.py b/app/apis.py index b81882e..69bf222 100644 --- a/app/apis.py +++ b/app/apis.py @@ -14,7 +14,7 @@ async def API_Version(): async def API_User_Details(email: str): user = models.User.query.filter_by(email=email).first() try: - assert user != None + assert user is not None except AssertionError: raise HTTPException(status_code=404, detail="User Not Found") return {"first_name": user.first_name, "last_name": user.last_name} diff --git a/app/tests/test_models.py b/app/tests/test_models.py index c84df92..0beb3b9 100644 --- a/app/tests/test_models.py +++ b/app/tests/test_models.py @@ -4,6 +4,6 @@ from app.models import User def test_usermodel(app, client): user = User(first_name="John", email="test@example.com", password="pass") assert user.full_name == "John None" - assert user.get_role() == None - assert user.get_team() == None - assert user.is_paid() == None + assert user.get_role() is None + assert user.get_team() is None + assert user.is_paid() is None |