@contextmanager
def check_exact_number_of_calls(object_with_method, method_name, num_calls):
 with check_number_of_calls(object_with_method, method_name, num_calls, num_calls):
  (yield)

@ contextmanager def check_exact_number_of_calls ( object_with_method , method_name , num_calls ) : with check_number_of_calls ( object_with_method , method_name , num_calls , num_calls ) : ( yield )
instruments the given method on the given object to verify the number of calls to the method is exactly equal to num_calls .