예제 #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']