def test_self_m2m(self):
        test = M2mSelf.objects.create(foo=42)
        a = M2mSelf.objects.create(foo=1)

        # add
        a.m2m.add(test)
        self.synchronize()
        self.assertRemoteCount(2, M2mSelf)
        b = M2mSelf.objects.db_manager(REMOTE).get(foo=1)
        k = M2mSelf.objects.db_manager(REMOTE).get(foo=42)
        self.assertEqual(1, b.m2m.count())
        self.assertEqual(1, k.m2m.count())
        b_k = b.m2m.all()[0]
        self.assertEqual(b_k.pk, k.pk)
        self.assertEqual(b_k.foo, k.foo)

        # clear
        self.wait()
        a.m2m.clear()
        self.synchronize()
        self.assertEqual(0, b.m2m.count())
        self.assertEqual(0, k.m2m.count())
Test if m2m symmetrical field is synced properly.
dataset/ETHPy150Open zlorf/django-synchro/synchro/tests.py/M2MSynchroTests.test_self_m2m