Beispiel #1
0
def acidfile_with_no_copies_is_impossible(context):
    try:
        ACIDFile(context.example_filename, 'w', copies=0)
    except ValueError:
        assert True
    else:
        assert False
Beispiel #2
0
def and_an_auxiliary_acidfile(context):
    context.auxiliary_acidfile = ACIDFile(context.auxiliary_filename, 'w')
Beispiel #3
0
def and_i_open_it_again(context):
    context.example_acidfile = ACIDFile(context.example_filename, 'r')
Beispiel #4
0
def and_i_reopen_it(context):
    context.example_acidfile.close()
    context.example_acidfile = ACIDFile(context.example_filename, 'r')
Beispiel #5
0
def given_an_example_acidfile_with_number_copies(context, number):
    number = int(number)
    context.example_acidfile = ACIDFile(context.example_filename,
                                        'w',
                                        copies=number)
Beispiel #6
0
def given_an_example_acidfile(context):
    context.example_acidfile = ACIDFile(context.example_filename, 'w')
Beispiel #7
0
def given_an_acidfile_written_in_a_with_statement(context):
    with ACIDFile(context.example_filename, 'w') as f:
        f.write(context.random_data)
Beispiel #8
0
def then_i_can_open_in_a_with_statement_and_read_the_same_data(context):
    with ACIDFile(context.example_filename, 'r') as f:
        assert f.read() == context.random_data