def acidfile_with_no_copies_is_impossible(context): try: ACIDFile(context.example_filename, 'w', copies=0) except ValueError: assert True else: assert False
def and_an_auxiliary_acidfile(context): context.auxiliary_acidfile = ACIDFile(context.auxiliary_filename, 'w')
def and_i_open_it_again(context): context.example_acidfile = ACIDFile(context.example_filename, 'r')
def and_i_reopen_it(context): context.example_acidfile.close() context.example_acidfile = ACIDFile(context.example_filename, 'r')
def given_an_example_acidfile_with_number_copies(context, number): number = int(number) context.example_acidfile = ACIDFile(context.example_filename, 'w', copies=number)
def given_an_example_acidfile(context): context.example_acidfile = ACIDFile(context.example_filename, 'w')
def given_an_acidfile_written_in_a_with_statement(context): with ACIDFile(context.example_filename, 'w') as f: f.write(context.random_data)
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