예제 #1
0
def test_get_atomic_table_path():
    table = Table(TEST_ID)
    atomic_tables = atomize(table)
    atomic_table = atomic_tables[0]
    _path = get_atomic_table_path(atomic_table, path=ATOMIC_TABLES_DIR)
    _PATH = os.path.join(ATOMIC_TABLES_DIR,
                         generate_atomic_table_id(atomic_table) + ".table")
    assert _path == _PATH
예제 #2
0
def test_dump_atomic_tables():
    table = Table(TEST_ID)
    atomic_tables = atomize(table)
    atomic_table = atomic_tables[0]
    _filepath = get_atomic_table_path(atomic_table, path=ATOMIC_TABLES_DIR)
    dump_atomic_table(atomic_table, path=ATOMIC_TABLES_DIR)
    #check if file was written to the directory
    assert os.path.exists(_filepath)
    #remove the file
    os.remove(_filepath)
    assert not os.path.exists(_filepath)
예제 #3
0
def test_rearrange_to_columns():
    table = Table(TEST_ID)
    table_data = table.fetch_table(TEST_ID)
    data = table.parse_table(table_data)
    header = table.extract_header(data)
    columns = table.rearrange_to_columns(header, data)
    assert data == TEST_DATA
예제 #4
0
def test_subject_column():
    table = Table(TEST_ID)
    assert table.subject_column == [0]
예제 #5
0
def test_parse_table():
    table = Table(TEST_ID)
    table_data = table.fetch_table(TEST_ID)
    data = table.parse_table(table_data)
    assert data == TEST_DATA
예제 #6
0
def test_extract_header():
    table = Table(TEST_ID)
    table_data = table.fetch_table(TEST_ID)
    data = table.parse_table(table_data)
    header = table.extract_header(data)
    assert header == TEST_HEADER
예제 #7
0
def test_fetch_table():
    table = Table(TEST_ID)
    table_data = table.fetch_table(TEST_ID)
    assert table_data == TEST_TABLE
예제 #8
0
def test_generate_atomic_table_id():
    table = Table(TEST_ID)
    atomic_tables = atomize(table)
    atomic_table = atomic_tables[0]
    _id = generate_atomic_table_id(atomic_table)
    assert _id == TABLE_ID
예제 #9
0
def test_atomize():
    table = Table(TEST_ID)
    atomic_tables = atomize(table)
    assert len(atomic_tables[0]) == 2
    assert len(atomic_tables[0][0]) == len(atomic_tables[0][1])
예제 #10
0
def get_one_table(offset):
    table_list = get_table_list()
    offset = offset % len(table_list)
    return Table(table_list[offset])