def test_repr_with_posts(self): b = Blog('Test title', 'Test author') b1 = Blog('Make my day', 'Sreenuraj') b.post = ['test'] b1.post = ['test', 'test1'] self.assertEqual(b.__repr__(), "Test title by Test author (1 Post)") self.assertEqual(b1.__repr__(), "Make my day by Sreenuraj (2 Posts)")
def test_createdPost(self): b = Blog('BookName1','sem') b1 = Blog('BookName2','kamlesh') b1.post = ['1_post'] b2 = Blog('BookName3','aman') b2.post = ['1_post','2_post'] self.assertEqual(b.__repr__(),"BookName1 is test by sem(0 posts)") self.assertEqual(b1.__repr__(),"BookName2 is test by kamlesh(1 posts)") self.assertEqual(b2.__repr__(),"BookName3 is test by aman(2 posts)")
def test_repr(self): b = Blog("Test_blog", "Test_blog_author") b2 = Blog("Pierwszy post", "Kuba") b2.post = ["testowy", "drugi testowy"] self.assertEqual(b.__repr__(), "Test_blog by Test_blog_author (0 post)") self.assertEqual(b2.__repr__(), "Pierwszy post by Kuba (2 posts)")