def test_model_unicode_trims_spaces_and_punctuation(self): word = self.faker.word() punctuation = ' .' comment = Comment( post=self.post, author=self.author, guest_name=self.guest_name, body=word + punctuation * (80 / len(punctuation))) self.assertEqual(comment.__unicode__()[:-3], word)
def test_model_unicode_is_a_part_of_comment_body(self): comment = Comment( post=self.post, author=self.author, guest_name=self.guest_name, body=self.body) self.assertIn(comment.__unicode__()[:-3], self.body) self.assertLessEqual(len(comment.__unicode__()), 80)