I am studying some Django testing codes and I find assertIn and assertContains quite similar, I read the documentation wherein they didn't say anything about assertIn or maybe I couldn't find it.
This example below checks if 'john' appears at the content of self.email.body
self.assertIn('john', self.email.body)
similary this example checks if csrfmiddlewaretoken appears at content of self.response
self.assertContains(self.response, 'csrfmiddlewaretoken')
Looks like there syntax is different, but there functionality is the same. Hence, what is the difference?
If you could kindly help me understand this with some basic examples, I would really appreciate it.
Thank you so much
Aucun commentaire:
Enregistrer un commentaire