示例#1
0
文件: string.py 项目: eBay/wextracto
 def _partition(obj):
     for s in flatten(obj):
         head, sep, tail = s.partition(separator)
         if normalize_head:
             head = normalize_head(head)
         if normalize_tail:
             tail = normalize_tail(tail)
         if sep:
             yield (head, tail)
示例#2
0
def test_flatten():
    assert list(i.flatten([['a'], ['b']])) == ['a', 'b']
示例#3
0
def test_flatten_nested():
    assert list(i.flatten([['a'], ['b', 'c']])) == ['a', 'b', 'c']
示例#4
0
def test_flatten_string():
    # A string isn't considered iterable so nothing should happen
    assert list(i.flatten('abc')) == ['abc']
示例#5
0
def test_flatten_nested():
    assert list(i.flatten([['a'], ['b', 'c']])) == ['a', 'b', 'c']
示例#6
0
def test_flatten_string():
    # A string isn't considered iterable so nothing should happen
    assert list(i.flatten('abc')) == ['abc']
示例#7
0
def test_flatten():
    assert list(i.flatten([['a'], ['b']])) == ['a', 'b']