def test_retrieve_tags_assigned_unique(self):
    'Test filtering tags by assigned returns unique items'
    tag = Tag.objects.create(user=self.user, name='Breakfast')
    Tag.objects.create(user=self.user, name='Lunch')
    recipe1 = Recipe.objects.create(title='Pancakes', time_minutes=5, price=3.0, user=self.user)
    recipe1.tags.add(tag)
    recipe2 = Recipe.objects.create(title='Porridge', time_minutes=3, price=2.0, user=self.user)
    recipe2.tags.add(tag)
    res = self.client.get(TAGS_URL, {'assigned_only': 1})
    self.assertEqual(len(res.data), 1)
Test filtering tags by assigned returns unique items
def test_retrieve_tags_assigned_unique(self):
    
    tag = Tag.objects.create(user=self.user, name='Breakfast')
    Tag.objects.create(user=self.user, name='Lunch')
    recipe1 = Recipe.objects.create(title='Pancakes', time_minutes=5, price=3.0, user=self.user)
    recipe1.tags.add(tag)
    recipe2 = Recipe.objects.create(title='Porridge', time_minutes=3, price=2.0, user=self.user)
    recipe2.tags.add(tag)
    res = self.client.get(TAGS_URL, {'assigned_only': 1})
    self.assertEqual(len(res.data), 1)