Esempio n. 1
0
def userobject2testname(user_object):
    init_call = user_object.get_init_call()
    external_calls = testable_calls(user_object.get_external_calls())

    if len(external_calls) == 0 and init_call:
        test_name = initcall2testname(init_call)
    else:
        if len(external_calls) == 1:
            call = external_calls[0]
            test_name = call2testname(call, call.definition.name)
        # Methods with more than one external call use more brief
        # descriptions that don't include inputs and outputs.
        else:
            methods = []
            for method, calls_count in counted(
                [call.definition.name for call in external_calls]):
                if calls_count == 1:
                    methods.append(method)
                else:
                    methods.append("%s_%d_times" % (method, calls_count))
            test_name = "test_%s" % '_and_'.join(methods)
        if init_call and init_call.input:
            test_name += "_after_creation_with_%s" % arguments_as_string(
                init_call.input)
    return test_name
Esempio n. 2
0
def userobject2testname(user_object):
    init_call = user_object.get_init_call()
    external_calls = testable_calls(user_object.get_external_calls())

    if len(external_calls) == 0 and init_call:
        test_name = initcall2testname(init_call)
    else:
        if len(external_calls) == 1:
            call = external_calls[0]
            test_name = call2testname(call, call.definition.name)
        # Methods with more than one external call use more brief
        # descriptions that don't include inputs and outputs.
        else:
            methods = []
            for method, calls_count in counted([call.definition.name for call in external_calls]):
                if calls_count == 1:
                    methods.append(method)
                else:
                    methods.append("%s_%d_times" % (method, calls_count))
            test_name = "test_%s" % '_and_'.join(methods)
        if init_call and init_call.input:
            test_name += "_after_creation_with_%s" % arguments_as_string(init_call.input)
    return test_name
Esempio n. 3
0
def object_usage_counts(timeline):
    return counted(resolve_dependencies(timeline))
Esempio n. 4
0
def object_usage_counts(timeline):
    return counted(resolve_dependencies(timeline))