mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
Fix tests on PostgreSQL
This commit is contained in:
parent
ed0cf42daa
commit
1851128c55
@ -63,9 +63,15 @@ class UpdateReturningTests(TestCase):
|
|||||||
assert updated.hits == obj.hits + 1, updated.hits
|
assert updated.hits == obj.hits + 1, updated.hits
|
||||||
|
|
||||||
def test_update_returning_values(self):
|
def test_update_returning_values(self):
|
||||||
UpdateReturningModel.objects.create(key="key1", content="content", hits=1)
|
obj1 = UpdateReturningModel.objects.create(
|
||||||
UpdateReturningModel.objects.create(key="key2", content="content", hits=2)
|
key="key1", content="content", hits=1
|
||||||
UpdateReturningModel.objects.create(key="key3", content="content", hits=3)
|
)
|
||||||
|
obj2 = UpdateReturningModel.objects.create(
|
||||||
|
key="key2", content="content", hits=2
|
||||||
|
)
|
||||||
|
obj3 = UpdateReturningModel.objects.create(
|
||||||
|
key="key3", content="content", hits=3
|
||||||
|
)
|
||||||
|
|
||||||
updated = UpdateReturningModel.objects.update_returning(
|
updated = UpdateReturningModel.objects.update_returning(
|
||||||
hits=F("hits") + 1
|
hits=F("hits") + 1
|
||||||
@ -75,9 +81,9 @@ class UpdateReturningTests(TestCase):
|
|||||||
assert len(updated) == 3
|
assert len(updated) == 3
|
||||||
updated.sort(key=lambda x: x["pk"])
|
updated.sort(key=lambda x: x["pk"])
|
||||||
assert updated == [
|
assert updated == [
|
||||||
{"pk": 1, "hits": 2},
|
{"pk": obj1.pk, "hits": 2},
|
||||||
{"pk": 2, "hits": 3},
|
{"pk": obj2.pk, "hits": 3},
|
||||||
{"pk": 3, "hits": 4},
|
{"pk": obj3.pk, "hits": 4},
|
||||||
]
|
]
|
||||||
|
|
||||||
def test_update_returning_values_list(self):
|
def test_update_returning_values_list(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user