-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: update pk field only raises unfriendly error #1873
base: develop
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #1873 will not alter performanceComparing Summary
|
Pull Request Test Coverage Report for Build 13179624319Details
💛 - Coveralls |
@@ -121,6 +123,8 @@ async def test_save_partial(self): | |||
n_mdl = await self.cls.get(id=self.mdl.id) | |||
self.assertEqual(n_mdl.name, "Test") | |||
self.assertEqual(n_mdl.desc, "Something") | |||
with pytest.raises(OperationalError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to have a separate test case for this os it is documented with tests and it is not just a check in an existing test.
I would also suggest another test case:
o.save()
o.id = 123
with pytest.raises(OperationalError):
o.save()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, but it's hard to do that -- because can't get the original id if it changed which make it difficult to know whether object only changed pk field value.
Description
Close #1870
Motivation and Context
Explicit raises OptionalError when executing
await model.save(update_fields=['id'])
How Has This Been Tested?
make ci
Checklist: