forked from spyoungtech/grequests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
26 lines (23 loc) · 637 Bytes
/
tests.py
File metadata and controls
26 lines (23 loc) · 637 Bytes
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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from grequests import get, map, imap
from nose.tools import ok_
########### Constants ############
urls = [
'http://github.com',
'http://www.google.com',
'http://www.psf.org'
]
############# tests ##############
def test_get():
global urls
to_fetch = (get(url) for url in urls)
map(to_fetch)
for fetched in to_fetch:
ok_(fetched.ok, True)
def test_imap_with_size():
global urls
to_fetch = (get(url) for url in urls)
imap(to_fetch, size = len(urls) - 1)
for fetching in to_fetch:
ok_(fetching.send(), True)