

def test_merging_relational_attributes(self):
    'Merging: ensure relational fields are properly saved/combined.'
    assertions = {
        'tags': set(Tag.objects.filter(name__in=['SWC', 'DC', 'LC'])),
        'task_set': set(Task.objects.none()),
        'todoitem_set': set(TodoItem.objects.filter(title='Find instructors')),
    }
    rv = self.client.post(self.url, data=self.strategy)
    self.assertEqual(rv.status_code, 302)
    self.event_b.refresh_from_db()
    for (key, value) in assertions.items():
        self.assertEqual(set(getattr(self.event_b, key).all()), value, key)

dataset/ETHPy150Open swcarpentry/amy/workshops/test/test_event.py TestEventMerging.test_merging_relational_attributes/original