(self)
| 1953 | self.assertEqual(qs["modern"], 2) |
| 1954 | |
| 1955 | def test_conditional_expression(self): |
| 1956 | qs = Season.objects.annotate( |
| 1957 | century=Case( |
| 1958 | When( |
| 1959 | GreaterThan(F("year"), 1900) & LessThanOrEqual(F("year"), 2000), |
| 1960 | then=Value("20th"), |
| 1961 | ), |
| 1962 | default=Value("other"), |
| 1963 | ) |
| 1964 | ).values("year", "century") |
| 1965 | self.assertCountEqual( |
| 1966 | qs, |
| 1967 | [ |
| 1968 | {"year": 1942, "century": "20th"}, |
| 1969 | {"year": 1842, "century": "other"}, |
| 1970 | {"year": 2042, "century": "other"}, |
| 1971 | ], |
| 1972 | ) |
| 1973 | |
| 1974 | def test_multivalued_join_reuse(self): |
| 1975 | self.assertEqual( |
nothing calls this directly
no test coverage detected