Example #1
0
def test_repr_multiple_posts():
    b = Blog('Test', 'Test Author')
    b.posts = ['test1', 'test2']
    b2 = Blog('My Day', 'Rolf')
    b2.posts = ['test1']
    assert b.__repr__() == 'Test by Test Author(2 posts)'
    assert b2.__repr__() == 'My Day by Rolf(1 post)'
Example #2
0
 def test_multiple_posts(self):
     b = Blog('Title', 'Name')
     b.posts = ['post']
     b1 = Blog('Learning', 'Dave')
     b1.posts = ['post1', 'post2', 'post3']
     self.assertEqual(b.__repr__(), 'Title by Name (1 post)')
     self.assertEqual(b1.__repr__(), 'Learning by Dave (3 posts)')
Example #3
0
 def test_repr_multiple_posts(self):
     b = Blog('Test', 'Test Author')
     b.posts = ['test']
     b2 = Blog('My Day', 'Rolf')
     b2.posts = ['test', 'another']
     self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')
     self.assertEqual(b2.__repr__(), 'My Day by Rolf (2 posts)')
Example #4
0
 def test_repr_multiple_posts(self):
     b = Blog('Test', 'Test Author')
     b.posts = ['test']
     b2 = Blog('Test_1', 'Test Author Two')
     b2.posts = ['test', 'test1']
     self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')
     self.assertEqual(b2.__repr__(), 'Test_1 by Test Author Two (2 posts)')
Example #5
0
    def test_repr(self):
        b = Blog('Test title', 'Test author')
        b.posts = ['test post']
        b2 = Blog('My Day', 'Rolf')
        b2.posts = ['test post', 'test 2']

        self.assertEqual(b.__repr__(), 'Test title by Test author (1 post )')
Example #6
0
    def test_multiple_repr(self):
        b = Blog('Test', "Test Author")
        b.posts = ['test']
        b2 = Blog('My Day', "Rolf")
        b2.posts = ['test', 'test2']

        self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')
        self.assertEqual(b2.__repr__(), 'My Day by Rolf (2 posts)')
Example #7
0
 def test_repr_multiple_posts(self):
     b = Blog('Test', 'Test Author')
     self.assertEqual('Test by Test Author (0 posts)', b.__repr__())
     b.posts = ['test']
     self.assertEqual('Test by Test Author (1 post)', b.__repr__())
     b2 = Blog('Test', 'Test Author')
     b2.posts = [1, 2]
     self.assertEqual('Test by Test Author (2 posts)', b2.__repr__())
Example #8
0
    def test_repr_multiple_posts(self):
        b = Blog('Test', 'Test Author')
        b2 = Blog('My Blog', 'Kinhos')
        b.posts = ['Post fake']
        b2.posts = ['Post fake', 'Post de mentira']

        self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')
        self.assertEqual(b2.__repr__(), 'My Blog by Kinhos (2 posts)')
Example #9
0
    def test_repr_multiple(self):
        b = Blog('Test', 'Test Author')
        b.posts = ['post1']
        b2 = Blog('My Day', 'John Smith')
        b2.posts = ['post1', 'post2', 'post3']

        self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')
        self.assertEqual('My Day by John Smith (3 posts)', b2.__repr__())
Example #10
0
    def test_repr_multiple_posts(self):
        b = Blog('Test', 'Test Author')
        b.posts = ['test']
        b2 = Blog('My Day', 'Eva')
        b2.posts = ['test', 'test2']

        self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')
        self.assertEqual(b2.__repr__(), 'My Day by Eva (2 posts)')
Example #11
0
    def test_repr_multiple_posts(self):
        blog = Blog('Blog Title', 'Author')
        blog.posts = ['content']
        blog2 = Blog('Blog Title', 'Blog Author')
        blog2.posts = ['content', 'another_content']

        self.assertEqual(blog.__repr__(), 'Blog Title by Author (1 post)')
        self.assertEqual(blog2.__repr__(), 'Blog Title by Blog Author (2 posts)')
Example #12
0
    def test_repr_multiple_posts(self):
        b = Blog('Test', "Test Author")
        b.posts = ['test']
        b2 = Blog('My Day', "Rolf")
        b2.posts = ['test', 'another']

        self.assertEqual(b.__repr__(), "<Test by Test Author (1 post)>")
        self.assertEqual(b2.__repr__(), "<My Day by Rolf (2 posts)>")
Example #13
0
    def test_posts(self):
        b = Blog("Love", "Kingsman")
        b.posts = ["Published by Yale Univ."]
        b2 = Blog("Star", "Wineman")
        b2.posts = ["Published by Standford Univ", "Published by Rice Univ"]

        self.assertEqual("Love by Kingsman (1 post)", b.__repr__())
        self.assertEqual("Star by Wineman (2 posts)", b2.__repr__())
Example #14
0
    def test_repr(self):
        b = Blog('Test', 'Test Author')
        b2 = Blog('See you', 'Mcha')
        b2.posts = ['test']
        b2.posts = ["test", "Mai"]

        self.assertEqual(b.__repr__(), 'Test by Test Author (0 posts)')
        self.assertEqual(b2.__repr__(), 'See you by Mcha (2 posts)')
Example #15
0
    def test_multiple_post(self):
        b = Blog('Test', 'Test Author')
        b.posts = ['Test Post']
        b2 = Blog('Test', 'Test Author')
        b2.posts = ['Test Post', 'Test Post']

        self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')
        self.assertEqual(b2.__repr__(), 'Test by Test Author (2 posts)')
Example #16
0
    def test_repr_multiple_posts(self):
        b = Blog("Test", "Test Author")
        b.posts = ["test"]
        b2 = Blog("My Day", "Rolf")
        b2.posts = ["test", "another"]

        self.assertEqual(b.__repr__(), "Test by Test Author (1 post)")
        self.assertEqual(b2.__repr__(), "My Day by Rolf (2 posts)")
Example #17
0
    def test_repr_multiple_post(self):
        b = Blog('Test', 'Test Author')
        b.posts = ['Test_post']

        b2 = Blog('Test2', 'Test2 Author')
        b2.posts = ['one', 'two']
        self.assertEqual(b.__repr__(), 'Test by Test Author (1 Post)')
        self.assertEqual(b2.__repr__(), 'Test2 by Test2 Author (2 Posts)')
	def test_repr_multiple_posts(self):
		b = Blog('Meet and eat', 'Tom')
		b.posts = ['food post']
		b1 = Blog('I have a dog', 'Mary P')
		b1.posts = ['some post', 'dog post']

		self.assertEqual(b.__repr__(), 'Meet and eat by Tom (1 post)')
		self.assertEqual(b1.__repr__(), 'I have a dog by Mary P (2 posts)')
Example #19
0
    def test_repr_multiple_posts(self):
        b = Blog('Test', 'Test Author')
        b.posts = ['test']
        b2 = Blog('My day', 'Athenkosi')
        b2.posts = ['test', 'Another']

        self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')
        self.assertEqual(b2.__repr__(), 'My day by Athenkosi (2 posts)')
Example #20
0
    def test_repr_multiple_posts(self):
        b = Blog("Test", "Test Author")
        b.posts = ['test']
        self.assertEqual(b.__repr__(), "Test by Test Author (1 post)")

        b2 = Blog("Life in California", "Roy Goode")
        b2.posts = ["howdy" for word in range(5)]
        self.assertEqual(b2.__repr__(), "Life in California by Roy Goode (5 posts)")
Example #21
0
    def test_multiple_repr(self):
        b = Blog('Test Blog', 'Manuel')
        b.posts = ['test']

        self.assertEqual("Test Blog by Manuel (1 post)", b.__repr__())

        b2 = Blog("my blog", 'Jordi')
        b2.posts = ['foo', 'bar']
        self.assertEqual("my blog by Jordi (2 posts)", b2.__repr__())
Example #22
0
    def test_repr_multiple_posts(self):
        b = Blog('Test', 'Test Author')
        b.posts = ['Test Post']

        b2 = Blog('My Days', 'Julie')
        b2.posts = ['Test', 'Another post']

        self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')
        self.assertEqual(b2.__repr__(), 'My Days by Julie (2 posts)')
Example #23
0
    def test_reprr_multiple_posts(self):
        b = Blog("Title blog", "Author blog")
        b.posts = ['test']
        b2 = Blog("John title", "Oliver author")
        b2.posts = ["test", "another"]

        self.assertEqual(b.__repr__(), "Title blog by Author blog (1 posts)")
        self.assertEqual(b2.__repr__(),
                         "John title by Oliver author (2 posts)")
Example #24
0
    def test_repr_multiple_posts(self):
        b = Blog("Název", "autor")
        b.posts = ["test"]

        b2 = Blog("Název2", "autor2")
        b2.posts = ["test1", "test2"]

        self.assertEqual(b.__repr__(), "Název by autor (1 post)")
        self.assertEqual(b2.__repr__(), "Název2 by autor2 (2 posts)")
    def test_repr_multiple_posts(self):
        b = Blog('Title', 'Test Author')
        b.posts = ['test']

        b2 = Blog('My Day', 'Rolf')
        b2.posts = ['test', 'another']

        self.assertEqual(b.__repr__(), ('{} by {} (1 post)'.format(b.title, b.author)))
        self.assertEqual(b2.__repr__(), ('{} by {} (2 posts)'.format(b2.title, b2.author)))
Example #26
0
    def test_repr_multi_posts(self):
        new_blog = Blog("Test Title", "Test Author")
        new_blog.posts = ["test post"]
        my_blog = Blog("Calvin's Blog", "Calvin T")
        my_blog.posts = ["A day in the life", "How I set up projects", "Last Day"]


        self.assertEqual(new_blog.__repr__(), "Test Title by Test Author (1 post)")
        self.assertEqual(my_blog.__repr__(), "Calvin's Blog by Calvin T (3 posts)")
Example #27
0
    def test_repr_multiple_post(self):
        b = Blog('Test', 'Test Author')
        b.posts = ['test post']

        self.assertEqual(b.__repr__(), 'Test by Test Author (1 post)')

        b2 = Blog('My Dad', 'Rolf')
        b2.posts = ['post1', 'post2']
        self.assertEqual(b2.__repr__(), 'My Dad by Rolf (2 posts)')
Example #28
0
 def test_repr(self):
     new_blog = Blog("My Test Blog", "Amazing Anonym Author")
     self.assertEqual(new_blog.__repr__(),
                      "My Test Blog by Amazing Anonym Author - 0 Posts")
     new_blog.posts = ["This is a test Post"]
     self.assertEqual(new_blog.__repr__(),
                      "My Test Blog by Amazing Anonym Author - 1 Post")
     new_blog.posts = ["This is a test Post", "This is another test post"]
     self.assertEqual(new_blog.__repr__(),
                      "My Test Blog by Amazing Anonym Author - 2 Posts")
Example #29
0
    def test_multiple_post_repr(self):
        blog_object = Blog('test_title', 'test_author')
        blog_object.posts = ['post']

        blog_object2 = Blog('test_title', 'test_author')
        blog_object2.posts = ['post1', 'post2']

        self.assertEqual(blog_object.__repr__(),
                         'test_title by test_author (1 post)')
        self.assertEqual(blog_object2.__repr__(),
                         'test_title by test_author (2 posts)')
Example #30
0
 def test_repr_multiple_post(self):
     b = Blog("Test", "Test Author")
     b.posts = ['test']
     b2 = Blog("My Day", "John")
     b2.posts = ['test', 'test2']
     self.assertEqual(
         b.__repr__(), 'Test by Test Author ({} post{})'.format(
             len(b.posts), 's' if len(b.posts) != 1 else ''))
     self.assertEqual(
         b2.__repr__(), 'My Day by John ({} post{})'.format(
             len(b2.posts), 's' if len(b2.posts) != 1 else ''))