def test_manual_wrapping_and_unwrapping(): got = wrap(Example(), Wrapper, Wrapper2) assert isinstance(got, Example) is True assert got.is_wrapped_up() is True assert got.can_be_unwrapped() is True got2 = unwrap(got) assert isinstance(got2, Example) is True assert hasattr(got2, 'is_wrapped_up') is False assert hasattr(got2, 'can_be_unwrapped') is False
def test_manual_wrapping(single_obj): got = ExampleRelation.wrapping_queryset.wrap(Wrapper).wrap(Wrapper2).get() me = wrap(single_obj, Wrapper, Wrapper2) assert got.pk == me.pk assert got.is_wrapped_up() is True assert got.can_be_unwrapped() is True assert me.is_wrapped_up() is True assert me.can_be_unwrapped() is True assert isinstance(got, ExampleRelation) is True assert isinstance(got, Wrapper2) is True assert isinstance(me, ExampleRelation) is True assert isinstance(me, Wrapper2) is True assert got == me