def can_clone_into_a_subclass(self): orig = Call(self.task) class MyCall(Call): pass clone = orig.clone(into=MyCall) eq_(clone, orig) ok_(isinstance(clone, MyCall))
def can_clone_into_a_subclass(self): orig = Call(self.task) class MyCall(Call): pass clone = orig.clone(into=MyCall) assert clone == orig assert isinstance(clone, MyCall)
def can_be_given_extra_kwargs_to_clone_with(self): orig = Call(self.task) class MyCall(Call): def __init__(self, *args, **kwargs): self.hooray = kwargs.pop("hooray") super(MyCall, self).__init__(*args, **kwargs) clone = orig.clone(into=MyCall, with_={"hooray": "woo"}) assert clone.hooray == "woo"
def returns_new_but_equivalent_object(self): orig = Call(self.task) clone = orig.clone() ok_(clone is not orig) ok_(clone == orig)