summaryrefslogtreecommitdiff
path: root/tests/update_only_fields
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2024-08-09 13:41:18 -0400
committernessita <124304+nessita@users.noreply.github.com>2024-08-28 11:44:05 -0300
commit52ed2b645e1dd8c9a874cfd21c4c9f2500032626 (patch)
treebfa241f52603c1dc378b038e37e0a6260a78c482 /tests/update_only_fields
parenta69f895d7de198d7082cd7275390fa2d2a3d5619 (diff)
Refs #35060 -- Adjusted deprecation warning stacklevel in Model.save()/asave().
Diffstat (limited to 'tests/update_only_fields')
-rw-r--r--tests/update_only_fields/tests.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/update_only_fields/tests.py b/tests/update_only_fields/tests.py
index 816112bc33..a6a5b7cb8e 100644
--- a/tests/update_only_fields/tests.py
+++ b/tests/update_only_fields/tests.py
@@ -262,10 +262,11 @@ class UpdateOnlyFieldsTests(TestCase):
msg = "Passing positional arguments to save() is deprecated"
with (
- self.assertWarnsMessage(RemovedInDjango60Warning, msg),
+ self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx,
self.assertNumQueries(0),
):
s.save(False, False, None, [])
+ self.assertEqual(ctx.filename, __file__)
async def test_empty_update_fields_positional_asave(self):
s = await Person.objects.acreate(name="Sara", gender="F")
@@ -273,8 +274,9 @@ class UpdateOnlyFieldsTests(TestCase):
s.name = "Other"
msg = "Passing positional arguments to asave() is deprecated"
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
+ with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
await s.asave(False, False, None, [])
+ self.assertEqual(ctx.filename, __file__)
# No save occurred for an empty update_fields.
await s.arefresh_from_db()