def check_sole_error(response, status, strings):
 if isinstance(strings, str):
  strings = [strings]
 assert (response.status_code == status)
 document = loads(response.data)
 errors = document['errors']
 assert (len(errors) == 1)
 error = errors[0]
 assert (error['status'] == status)
 assert all(((s in error['detail']) for s in strings))

def check_sole_error ( response , status , strings ) : if isinstance ( strings , str ) : strings = [ strings ] assert ( response . status_code == status ) document = loads ( response . data ) errors = document [ 'errors' ] assert ( len ( errors ) == 1 ) error = errors [ 0 ] assert ( error [ 'status' ] == status ) assert all ( ( ( s in error [ 'detail' ] ) for s in strings ) )
asserts that the response is an errors response with a single error object whose detail message contains all of the given strings .