'Make sure as_sql works with subqueries and primary/replica.'

def test_subquery(self):

    sub = Person.objects.using('other').filter(name='fff')
    qs = Book.objects.filter(editor__in=sub)
    msg = "Subqueries    aren't    allowed    across    different    databases.    Force    the    inner    query    to    be    evaluated    using    `list(inner_query)`."
    with self.assertRaisesMessage(ValueError, msg):
        str(qs.query)
    with self.assertRaisesMessage(ValueError, msg):
        for obj in qs:
            pass
