Example #1
0
def get_book_stream(**keywords):
    """
    Get an instance of BookStream from an excel source

    Where the dictionary should have text as keys and two dimensional
    array as values.
    """
    a_source = SOURCE.get_book_source(**keywords)
    sheets = a_source.get_data()
    filename, path = a_source.get_source_info()
    return BookStream(sheets, filename=filename, path=path)
Example #2
0
def test_load_from_empty_sheets():
    bs = BookStream()
    bs.load_from_sheets(None)
    assert bs.number_of_sheets() == 0
Example #3
0
def test_book_stream():
    bs = BookStream()
    assert bs.number_of_sheets() == 0
Example #4
0
def test_key_sorting():
    adict = {"cd": [[1, 3]], "ab": [[2, 3]]}
    bs = BookStream(adict)
    # bs[0] should be 'ab' : SheetStream([[2,3]])
    assert bs[0].payload == [[2, 3]]
Example #5
0
def test_get_book_headers_in_array():
    data = iter([["a", "b", "c"], [1, 2, 3]])
    book_stream = BookStream({"test": data})
    colnames_array = get_book_headers_in_array(book_stream)
    eq_(colnames_array, [["a", "b", "c"]])
Example #6
0
def test_get_book_headers_in_array():
    data = iter([['a', 'b', 'c'], [1, 2, 3]])
    book_stream = BookStream({'test': data})
    colnames_array = get_book_headers_in_array(book_stream)
    eq_(colnames_array, [['a', 'b', 'c']])