def test_names_objects_appropriatelly(self):
        obj = create(SequenceObject)
        call = create(FunctionCall, args={'x': obj}, output=obj,
                      definition=create(Function, args=['x']))
        obj2 = create(SequenceObject)
        put_on_timeline(obj, call, obj2)

        timeline = name_objects_on_timeline([obj, call, obj2])
        assert_assignment(timeline[0], 'alist1', obj)
        assert_equal(call, timeline[1])
        assert_assignment(timeline[2], 'alist2', obj2)
Ejemplo n.º 2
0
    def test_names_objects_appropriatelly(self):
        obj = create(SequenceObject)
        call = create(FunctionCall,
                      args={'x': obj},
                      output=obj,
                      definition=create(Function, args=['x']))
        obj2 = create(SequenceObject)
        put_on_timeline(obj, call, obj2)

        timeline = name_objects_on_timeline([obj, call, obj2])
        assert_assignment(timeline[0], 'alist1', obj)
        assert_equal(call, timeline[1])
        assert_assignment(timeline[2], 'alist2', obj2)
Ejemplo n.º 3
0
def generate_test_case(testable_interaction, template):
    """This functions binds all other functions from generator submodules
    together (assertions, cleaner, optimizer, objects_namer and builder),
    implementing full test generation process, from a testable interaction
    object to a test case string.

    Call|UserObject|Method|Function -> assertions_for_interaction ->
      [Event] -> remove_objects_unworthy_of_naming ->
        [Event] -> optimize ->
          [Event] -> name_objects_on_timeline ->
            [Event] -> generate_test_contents ->
              CodeString
    """
    return \
        generate_test_contents(
            name_objects_on_timeline(
                optimize(
                    remove_objects_unworthy_of_naming(
                        assertions_for_interaction(testable_interaction)))),
            template)
Ejemplo n.º 4
0
def generate_test_case(testable_interaction, template):
    """This functions binds all other functions from generator submodules
    together (assertions, cleaner, optimizer, objects_namer and builder),
    implementing full test generation process, from a testable interaction
    object to a test case string.

    Call|UserObject|Method|Function -> assertions_for_interaction ->
      [Event] -> remove_objects_unworthy_of_naming ->
        [Event] -> optimize ->
          [Event] -> name_objects_on_timeline ->
            [Event] -> generate_test_contents ->
              CodeString
    """
    return \
        generate_test_contents(
            name_objects_on_timeline(
                optimize(
                    remove_objects_unworthy_of_naming(
                        assertions_for_interaction(testable_interaction)))),
            template)