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