def test_doesnt_include_side_effects_of_method_calls_into_user_object_test_case(self): klass = Class("UserClass") user_obj = UserObject(None, klass) init = Method("__init__", klass=klass) init_call = MethodCall(definition=init, args={}, output=user_obj) method1 = Method("method1", klass=klass) method1_call = MethodCall(definition=method1, args={}, output=create(ImmutableObject)) se1 = GlobalRebind('mod', 'var', ImmutableObject('new_value')) method1_call.add_side_effect(se1) method2 = Method("method2", klass=klass) method2_call = MethodCall(definition=method2, args={}, output=create(ImmutableObject)) se2 = AttributeRebind(user_obj, 'attr', create(ImmutableObject, obj=1)) method2_call.add_side_effect(se2) user_obj.add_call(init_call) user_obj.add_call(method1_call) user_obj.add_call(method2_call) put_on_timeline(user_obj, init_call, method1_call, se1, method2_call, se2) assert_equal_types(assertions_for_interaction(user_obj), [UserObject, EqualAssertionLine, EqualAssertionLine, EqualAssertionLine, EqualAssertionLine, ImmutableObject, ImmutableObject])
def test_doesnt_include_side_effects_of_method_calls_into_user_object_test_case( self): klass = Class("UserClass") user_obj = UserObject(None, klass) init = Method("__init__", klass=klass) init_call = MethodCall(definition=init, args={}, output=user_obj) method1 = Method("method1", klass=klass) method1_call = MethodCall(definition=method1, args={}, output=create(ImmutableObject)) se1 = GlobalRebind('mod', 'var', ImmutableObject('new_value')) method1_call.add_side_effect(se1) method2 = Method("method2", klass=klass) method2_call = MethodCall(definition=method2, args={}, output=create(ImmutableObject)) se2 = AttributeRebind(user_obj, 'attr', create(ImmutableObject, obj=1)) method2_call.add_side_effect(se2) user_obj.add_call(init_call) user_obj.add_call(method1_call) user_obj.add_call(method2_call) put_on_timeline(user_obj, init_call, method1_call, se1, method2_call, se2) assert_equal_types(assertions_for_interaction(user_obj), [ UserObject, EqualAssertionLine, EqualAssertionLine, EqualAssertionLine, EqualAssertionLine, ImmutableObject, ImmutableObject ])