Exemplo n.º 1
0
 def test_hash(self):
     """ Test Meme class __hash__ method
     """
     A = memesites.Meme('1', '2')
     B = memesites.Meme('1', '3')
     C = memesites.Meme('1', '2')
     D = memesites.Meme('2', '3')
     self.assertTrue(len(set([A, B, C, D])) == 3)
Exemplo n.º 2
0
 def test_ne(self):
     """ Test Meme class __ne__ method
     """
     A = memesites.Meme('1', '2')
     B = memesites.Meme('1', '3')
     C = memesites.Meme('1', '2')
     D = memesites.Meme('2', '3')
     self.assertFalse(A != A and B != B and C != C and D != D)
     self.assertFalse(A != C)
     self.assertTrue(A != B)
     self.assertTrue(A != D)
     self.assertTrue(B != D)
Exemplo n.º 3
0
 def test_eq(self):
     """ Test Meme class equality
     """
     A = memesites.Meme('1', '2')
     B = memesites.Meme('1', '3')
     C = memesites.Meme('1', '2')
     D = memesites.Meme('2', '3')
     self.assertTrue(A == A and B == B and C == C and D == D)
     self.assertTrue(A == C)
     self.assertFalse(A == B)
     self.assertFalse(A == D)
     self.assertFalse(B == D)
Exemplo n.º 4
0
    def test_init(self):
        """ Test the initialization routine of Meme class
        """
        A = memesites.Meme('1', '2')

        self.assertTrue(A.get_pic_url() == '1')
        self.assertTrue(A.get_time() == '2')
        self.assertTrue(A.get_caption() is None)
        self.assertTrue(A.get_origin() == memesites.Origins.NA)
        self.assertTrue(A.get_tags() == [])
Exemplo n.º 5
0
def mock_get_memes(*args, **kwargs):
    """ Mock function for the get_memes function

    Create a phony list of Memes
    """
    a = []
    for i in range(args[0]):
        a.append(
            memesites.Meme(i,
                           datetime.datetime.now(),
                           caption=str(i),
                           raw_pic_url=str(i),
                           origin=memesites.Origins.NA,
                           tags=[],
                           score=i))
    return a