commit 17318fee13a9d9392d233cbc417fb0b0880b5747
Author: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Date: Thu May 23 08:11:21 2019 +0200
test
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py
index f0c4bba999..74acd5f011 100644
a
|
b
|
class OrderingTests(TestCase):
|
210 | 210 | def test_reverse_ordering_pure(self): |
211 | 211 | qs1 = Article.objects.order_by(F('headline').asc()) |
212 | 212 | qs2 = qs1.reverse() |
| 213 | self.assertQuerysetEqual( |
| 214 | qs2, [ |
| 215 | "Article 4", |
| 216 | "Article 3", |
| 217 | "Article 2", |
| 218 | "Article 1", |
| 219 | ], |
| 220 | attrgetter("headline") |
| 221 | ) |
213 | 222 | self.assertQuerysetEqual( |
214 | 223 | qs1, [ |
215 | 224 | "Article 1", |
… |
… |
class OrderingTests(TestCase):
|
219 | 228 | ], |
220 | 229 | attrgetter("headline") |
221 | 230 | ) |
| 231 | |
| 232 | def test_reverse_meta_ordering_pure(self): |
| 233 | Article.objects.create( |
| 234 | headline='Article 5', |
| 235 | pub_date=datetime(2005, 7, 30), |
| 236 | author=self.author_1, |
| 237 | second_author=self.author_2, |
| 238 | ) |
| 239 | Article.objects.create( |
| 240 | headline='Article 5', |
| 241 | pub_date=datetime(2005, 7, 30), |
| 242 | author=self.author_2, |
| 243 | second_author=self.author_1, |
| 244 | ) |
222 | 245 | self.assertQuerysetEqual( |
223 | | qs2, [ |
224 | | "Article 4", |
225 | | "Article 3", |
226 | | "Article 2", |
227 | | "Article 1", |
228 | | ], |
229 | | attrgetter("headline") |
| 246 | Article.objects.filter(headline='Article 5').reverse(), |
| 247 | ['Name 2', 'Name 1'], |
| 248 | attrgetter('author.name'), |
| 249 | ) |
| 250 | self.assertQuerysetEqual( |
| 251 | Article.objects.filter(headline='Article 5'), |
| 252 | ['Name 1', 'Name 2'], |
| 253 | attrgetter('author.name'), |
230 | 254 | ) |
231 | 255 | |
232 | 256 | def test_no_reordering_after_slicing(self): |