def test_ignores_badly_stored_values():
    backend = SQLiteExampleDatabase(':memory:')
    backend.create_db_if_needed()
    with backend.cursor() as cursor:
        cursor.execute("""
            insert into hypothesis_data_mapping(key, value)
            values(?, ?)
        """, (base64.b64encode(b'foo'), u'kittens'))
    assert list(backend.fetch(b'foo')) == []
Ejemplo n.º 2
0
def test_ignores_badly_stored_values():
    backend = SQLiteExampleDatabase(':memory:')
    backend.create_db_if_needed()
    with backend.cursor() as cursor:
        cursor.execute("""
            insert into hypothesis_data_mapping(key, value)
            values(?, ?)
        """, (base64.b64encode(b'foo'), u'kittens'))
    assert list(backend.fetch(b'foo')) == []
def test_does_not_commit_in_error_state():
    backend = SQLiteExampleDatabase(':memory:')
    backend.create_db_if_needed()
    try:
        with backend.cursor() as cursor:
            cursor.execute("""
                insert into hypothesis_data_mapping(key, value)
                values("a", "b")
            """)
            raise ValueError()
    except ValueError:
        pass

    assert list(backend.fetch(b'a')) == []
def test_does_not_commit_in_error_state():
    backend = SQLiteExampleDatabase(':memory:')
    backend.create_db_if_needed()
    try:
        with backend.cursor() as cursor:
            cursor.execute("""
                insert into hypothesis_data_mapping(key, value)
                values("a", "b")
            """)
            raise ValueError()
    except ValueError:
        pass

    assert list(backend.fetch(b'a')) == []
def test_can_double_close():
    backend = SQLiteExampleDatabase(':memory:')
    backend.create_db_if_needed()
    backend.close()
    backend.close()
def test_can_double_close():
    backend = SQLiteExampleDatabase(':memory:')
    backend.create_db_if_needed()
    backend.close()
    backend.close()