| 19 | class RawQueryTests(TestCase): |
| 20 | @classmethod |
| 21 | def setUpTestData(cls): |
| 22 | cls.a1 = Author.objects.create( |
| 23 | first_name="Joe", last_name="Smith", dob=date(1950, 9, 20) |
| 24 | ) |
| 25 | cls.a2 = Author.objects.create( |
| 26 | first_name="Jill", last_name="Doe", dob=date(1920, 4, 2) |
| 27 | ) |
| 28 | cls.a3 = Author.objects.create( |
| 29 | first_name="Bob", last_name="Smith", dob=date(1986, 1, 25) |
| 30 | ) |
| 31 | cls.a4 = Author.objects.create( |
| 32 | first_name="Bill", last_name="Jones", dob=date(1932, 5, 10) |
| 33 | ) |
| 34 | cls.b1 = Book.objects.create( |
| 35 | title="The awesome book", |
| 36 | author=cls.a1, |
| 37 | paperback=False, |
| 38 | opening_line=( |
| 39 | "It was a bright cold day in April and the clocks were striking " |
| 40 | "thirteen." |
| 41 | ), |
| 42 | ) |
| 43 | cls.b2 = Book.objects.create( |
| 44 | title="The horrible book", |
| 45 | author=cls.a1, |
| 46 | paperback=True, |
| 47 | opening_line=( |
| 48 | "On an evening in the latter part of May a middle-aged man " |
| 49 | "was walking homeward from Shaston to the village of Marlott, " |
| 50 | "in the adjoining Vale of Blakemore, or Blackmoor." |
| 51 | ), |
| 52 | ) |
| 53 | cls.b3 = Book.objects.create( |
| 54 | title="Another awesome book", |
| 55 | author=cls.a1, |
| 56 | paperback=False, |
| 57 | opening_line="A squat gray building of only thirty-four stories.", |
| 58 | ) |
| 59 | cls.b4 = Book.objects.create( |
| 60 | title="Some other book", |
| 61 | author=cls.a3, |
| 62 | paperback=True, |
| 63 | opening_line="It was the day my grandmother exploded.", |
| 64 | ) |
| 65 | cls.c1 = Coffee.objects.create(brand="dunkin doughnuts") |
| 66 | cls.c2 = Coffee.objects.create(brand="starbucks") |
| 67 | cls.r1 = Reviewer.objects.create() |
| 68 | cls.r2 = Reviewer.objects.create() |
| 69 | cls.r1.reviewed.add(cls.b2, cls.b3, cls.b4) |
| 70 | |
| 71 | def assertSuccessfulRawQuery( |
| 72 | self, |