-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetect_test.py
37 lines (28 loc) · 1.23 KB
/
detect_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import unittest
from detect import Detect
long_url = ('PyBites My Reading List | 12 Rules for Life - #booksdiedeme.siejdis. '
'that expand the mind! '
'www.google.com/telephone/wire.... '
'http://pbreadinglist.herokuapp.com/books/'
'TvEqDAAAQBAJ#.XVOriU5z2tA.twitter '
"http://-www.pip.org "
' #psychology #philosophy')
short_url = ("google.com "
"twitter.com "
"facebook.com"
" University of ilorin .org"
" pybites.com")
TWEET = ('New PyBites article: Module of the Week - Requests-cache '
'for Repeated API Calls - http://pybit.es/requests-cache.html '
'#python #APIs')
class MyTestCase(unittest.TestCase):
def test_long_url(self):
expected = ['www.google.com/telephone/wire',\
'http://pbreadinglist.herokuapp.com/books/TvEqDAAAQBAJ#.XVOriU5z2tA.twitter',\
'www.pip.org']
self.assertEqual(Detect(long_url).url, expected)
def test_short_url(self):
expected = ['google.com', 'twitter.com', 'facebook.com', "pybites.com"]
self.assertEqual(Detect(short_url).url, expected)
if __name__ == '__main__':
unittest.main()