5 url
= "http://reddit.com/"
7 def non_empty_string(s
):
8 return type(s
) in [str, unicode] and len(s
.strip()) > 0
12 val
= reddit
.get_url(url
)
13 assert type(val
) is str and len(val
) > 0
15 def test_reddit_links():
16 r
= reddit
.Reddit(url
)
20 def test_guess_time():
22 ("21 hours", 21*60*60),
23 ("7 Days 21 hours", 7*24*60*60 + 21*60*60),
27 g
= reddit
.guess_time(s
)
28 assert type(g
) is int, "Must return time in seconds"
30 "guess_time(s) returned %d, while expected %d" % (g
, t
)
34 assert non_empty_string(l
.href
)
35 assert non_empty_string(l
.title
)
36 assert non_empty_string(l
.user
)
37 assert non_empty_string(l
.comments_href
)
38 assert type(l
.comments
) is int
39 assert type(l
.score
) is int or l
.score
is None