Esempio n. 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
Esempio n. 2
0
def and_an_auxiliary_acidfile(context):
    context.auxiliary_acidfile = ACIDFile(context.auxiliary_filename, 'w')
Esempio n. 3
0
def and_i_open_it_again(context):
    context.example_acidfile = ACIDFile(context.example_filename, 'r')
Esempio n. 4
0
def and_i_reopen_it(context):
    context.example_acidfile.close()
    context.example_acidfile = ACIDFile(context.example_filename, 'r')
Esempio n. 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)
Esempio n. 6
0
def given_an_example_acidfile(context):
    context.example_acidfile = ACIDFile(context.example_filename, 'w')
Esempio n. 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)
Esempio n. 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