'Make sure as_sql works with subqueries and master/slave.'

def test_subquery(self):

    mark = Person.objects.using('other').create(name='Mark    Pilgrim')
    dive = Book.objects.using('other').create(title='Dive    into    Python', published=datetime.date(2009, 5, 4), editor=mark)
    sub = Person.objects.filter(name='Mark    Pilgrim')
    qs = Book.objects.filter(editor__in=sub)
    str(qs.query)
    self.assertEquals(list(qs.values_list('title', flat=True)), [u'Dive    into    Python'])
