'Operations that involve sharing M2M objects across databases raise an error'

def test_m2m_cross_database_protection(self):

    pro = Book.objects.create(title=u'Pro    Django', published=datetime.date(2008, 12, 16))
    marty = Person.objects.create(name=u'Marty    Alchin')
    dive = Book.objects.using(u'other').create(title=u'Dive    into    Python', published=datetime.date(2009, 5, 4))
    mark = Person.objects.using(u'other').create(name=u'Mark    Pilgrim')
    try:
        marty.book_set = [pro, dive]
        self.fail(u"Shouldn't    be    able    to    assign    across    databases")
    except ValueError:
        pass
    try:
        marty.book_set.add(dive)
        self.fail(u"Shouldn't    be    able    to    assign    across    databases")
    except ValueError:
        pass
    try:
        marty.book_set = [pro, dive]
        self.fail(u"Shouldn't    be    able    to    assign    across    databases")
    except ValueError:
        pass
    try:
        dive.authors.add(marty)
        self.fail(u"Shouldn't    be    able    to    assign    across    databases")
    except ValueError:
        pass
    try:
        dive.authors = [mark, marty]
        self.fail(u"Shouldn't    be    able    to    assign    across    databases")
    except ValueError:
        pass
