Exemplo n.º 1
0
def test_writer_supports_multiple_modes():
    f = StringIO()
    iterable('123', writer(f, 'writelines'))
    f.seek(0)
    result = f.read()
    print result
    assert result == '123'
Exemplo n.º 2
0
def test_writer_supports_multiple_modes():
    f = StringIO()
    iterable('123', writer(f, 'writelines'))
    f.seek(0)
    result = f.read()
    print result
    assert result == '123'
Exemplo n.º 3
0
def test_iterable_with_string():
    li = list()
    iterable(u'abc', collection(li))
    for letter in 'abc':
        assert letter in li
Exemplo n.º 4
0
def test_blackhole():
    iterable('anything', blackhole())
Exemplo n.º 5
0
def test_collection_with_sets():
    s = set()
    iterable('abc', collection(s))
    for letter in 'abc':
        assert letter in s
Exemplo n.º 6
0
def test_collection_with_lists():
    c = list()
    iterable('abc', collection(c))
    assert c == ['a', 'b', 'c']
Exemplo n.º 7
0
def test_writer_on_filelike():
    f = StringIO()
    iterable('123', writer(f, 'write'))
    f.seek(0)
    result = f.read()
    assert result == '123'
Exemplo n.º 8
0
def test_writer_on_std_file_descriptors():
    iterable('123', writer(sys.stdout))
Exemplo n.º 9
0
def test_printer():
    iterable('123', printer())
Exemplo n.º 10
0
def test_iterable_with_string():
    li = list()
    iterable(u'abc', collection(li))
    for letter in 'abc':
    	assert letter in li
Exemplo n.º 11
0
def test_blackhole():
    iterable('anything', blackhole())
Exemplo n.º 12
0
def test_collection_with_sets():
    s = set()
    iterable('abc', collection(s))
    for letter in 'abc':
        assert letter in s
Exemplo n.º 13
0
def test_collection_with_lists():
    c = list()
    iterable('abc', collection(c))
    assert c == ['a', 'b', 'c'] 
Exemplo n.º 14
0
def test_writer_on_filelike():
    f = StringIO()
    iterable('123', writer(f, 'write'))
    f.seek(0)
    result = f.read()
    assert result == '123'
Exemplo n.º 15
0
def test_writer_on_std_file_descriptors():
    iterable('123', writer(sys.stdout))
Exemplo n.º 16
0
def test_printer():
    iterable('123', printer())