Ejemplo n.º 1
0
def split_function_database():
    """
    Generates a custom database to test the split_database function
    """
    database = Database('sqlite:///:memory:')
    for i in range(1, 11):
        entry = DatabaseEntry()
        database.add(entry)
        # every fourth entry gets the instrument 'EIA'
        if i % 4 == 0:
            database.edit(entry, instrument='EIA')
        # every fifth entry gets the instrument 'AIA_3'
        elif i % 5 == 0:
            database.edit(entry, instrument='AIA_3')
        # every other entry gets instrument 'RHESSI'
        else:
            database.edit(entry, instrument='RHESSI')
        # all  entries have provider 'xyz'
        database.edit(entry, provider='xyz')
    database.commit()
    return database
Ejemplo n.º 2
0
def split_function_database():
    """
    Generates a custom database to test the split_database function
    """
    database = Database('sqlite:///:memory:')
    for i in range(1, 11):
        entry = DatabaseEntry()
        database.add(entry)
        # every fourth entry gets the instrument 'EIA'
        if i % 4 == 0:
            database.edit(entry, instrument='EIA')
        # every fifth entry gets the instrument 'AIA_3'
        elif i % 5 == 0:
            database.edit(entry, instrument='AIA_3')
        # every other entry gets instrument 'RHESSI'
        else:
            database.edit(entry, instrument='RHESSI')
        # all  entries have provider 'xyz'
        database.edit(entry, provider='xyz')
    database.commit()
    return database