mirror of https://github.com/flaggo/pydu.git
add testcase for py3helpers
This commit is contained in:
parent
8bd9fd7791
commit
cffe1d87d9
|
@ -0,0 +1,34 @@
|
|||
from pylib.py3helpers import (iterkeys, itervalues, iteritems, is_iter,
|
||||
text_type, string_types, numeric_types)
|
||||
|
||||
|
||||
def test_iter():
|
||||
d = dict(a=1, b=2)
|
||||
for key in iterkeys(d):
|
||||
assert key in ('a', 'b')
|
||||
|
||||
for value in itervalues(d):
|
||||
assert value in (1, 2)
|
||||
|
||||
for items in iteritems(d):
|
||||
assert items in (('a', 1), ('b', 2))
|
||||
|
||||
assert is_iter(iter([]))
|
||||
|
||||
|
||||
def test_types():
|
||||
assert isinstance(u'a', text_type)
|
||||
|
||||
assert isinstance(u'a', string_types)
|
||||
assert isinstance('a', string_types)
|
||||
|
||||
assert isinstance(1, numeric_types)
|
||||
assert isinstance(2**50, numeric_types)
|
||||
|
||||
|
||||
def test_urljoin():
|
||||
from pylib.py3helpers import urljoin
|
||||
|
||||
|
||||
def test_imap():
|
||||
from pylib.py3helpers import imap
|
Loading…
Reference in New Issue