6👍
✅
I’m not sure I understand either what’s the difference between what do you want to test, and the normal behavior of django models…
but isn’t a simple field lookup better for that assertion?
https://docs.djangoproject.com/en/dev/topics/db/queries/
self.assertEqual(entry1.tags.get(pk=tag1.pk), tag1)
also, there’re some custom assertions inside django’s unittest:
assertQuerySetEqual might be more appropriate when using .all
or .filter
Source:stackexchange.com