def test_itercsv_emits_data_lines():
    """itercsv should yield individual lines of CSV, with headers"""
    expected = [
        b'Hello,World\r\n',
        b'1,2\r\n',
        b'3,4\r\n'
    ]
    assert list(itercsv(['Hello', 'World'], [[1, 2], [3, 4]])) == expected
Example #2
0
def test_itercsv_always_emits_headers():
    """itercsv should always emit headers, even where there is no data"""
    assert list(itercsv(['Hello', 'World'], [])) == [b'Hello,World\r\n']
def test_itercsv_emits_data_lines():
    """itercsv should yield individual lines of CSV, with headers"""
    expected = [b"Hello,World\r\n", b"1,2\r\n", b"3,4\r\n"]
    assert list(itercsv(["Hello", "World"], [[1, 2], [3, 4]])) == expected
def test_itercsv_always_emits_headers():
    """itercsv should always emit headers, even where there is no data"""
    assert list(itercsv(["Hello", "World"], [])) == [b"Hello,World\r\n"]