def test_read_datetime():
    content = '\n    date count\n    2020-01-01 1\n    2020-01-02 1\n    2020-01-03 2\n    2020-01-04 3\n    2020-01-05 5\n    2020-01-06 8\n    2020-01-07 13\n    2020-01-08 21\n    2020-01-09 34\n    '
    expect_rows = 9
    expect_count = [1, 1]
    for i in range((expect_rows - 2)):
        expect_count.append((expect_count[i] + expect_count[(i + 1)]))
    path = 'test_read_datetime.ssv'
    with open(path, encoding='utf-8', mode='w') as f:
        f.write(content)
    columns = [date_column('date'), ('count', np.int_)]
    df = read_table(path, columns)
    os.remove(path)
    assert (len(df) == expect_rows)
    for (ix, row) in enumerate(df):
        assert isinstance(row['date'], datetime.datetime)
        assert (row['date'].year == 2020)
        assert (row['date'].month == 1)
        assert (row['date'].day == (ix + 1))
        assert (row['count'] == expect_count[ix])
def test_read_datetime():
    content = '\n    date count\n    2020-01-01 1\n    2020-01-02 1\n    2020-01-03 2\n    2020-01-04 3\n    2020-01-05 5\n    2020-01-06 8\n    2020-01-07 13\n    2020-01-08 21\n    2020-01-09 34\n    '
    expect_rows = 9
    expect_count = [1, 1]
    for i in range((expect_rows - 2)):
        expect_count.append((expect_count[i] + expect_count[(i + 1)]))
    path = 'test_read_datetime.ssv'
    with open(path, encoding='utf-8', mode='w') as f:
        f.write(content)
    columns = [date_column('date'), ('count', np.int_)]
    df = read_table(path, columns)
    os.remove(path)
    assert (len(df) == expect_rows)
    for (ix, row) in enumerate(df):
        assert isinstance(row['date'], datetime.datetime)
        assert (row['date'].year == 2020)
        assert (row['date'].month == 1)
        assert (row['date'].day == (ix + 1))
        assert (row['count'] == expect_count[ix])