Monday, October 28, 2013

What's the difference between assertIn and assertContains?

    # List word
    def test_VIEW_Index_WORD_List_word(self):
        w = self.create_word()
        url = reverse('navi_polls:index')
        resp = self.client.get(url)
        self.assertEqual(resp.status_code, 200)
        self.assertIn(w.rosword, resp.content) # What's the difference between
                                                               # assertIn and assertContains?
        #self.assertContains(resp, "Test word")
        self.assertContains(resp, w.rosword)


test_VIEW_Index_WORD_List_word (navi_polls.tests.WordTests) ... ok



What's the difference between assertIn and assertContains?
They seem to perform the same kind of test, the only difference I can see is that the syntax differs.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3b734ceb-31bd-4b9e-b33f-d8310bcac20c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment