Skip to content

Commit

Permalink
Merge 3971259 into c16f28a
Browse files Browse the repository at this point in the history
  • Loading branch information
charlax committed Oct 5, 2018
2 parents c16f28a + 3971259 commit b8cf3d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doubles/proxy_method.py
Expand Up @@ -98,6 +98,10 @@ def __name__(self):
def __doc__(self):
return self._original_method.__doc__

@property
def __wrapped__(self):
return self._original_method

def restore_original_method(self):
"""Replaces the proxy method on the target object with its original value."""

Expand Down
10 changes: 10 additions & 0 deletions test/allow_test.py
@@ -1,5 +1,8 @@
import inspect
import re
import sys

import pytest
from pytest import raises

from doubles.exceptions import (
Expand Down Expand Up @@ -74,6 +77,13 @@ def test_proxies_name(self):

assert subject.method_with_doc.__name__ == "method_with_doc"

@pytest.mark.skipif(sys.version_info <= (3, 3), reason="requires Python 3.3 or higher")
def test_proxies_can_be_inspected(self):
subject = InstanceDouble("doubles.testing.User")
allow(subject).instance_method
parameters = inspect.signature(subject.instance_method).parameters
assert len(parameters) == 1


class TestWithArgs(object):
def test__call__is_short_hand_for_with_args(self):
Expand Down

0 comments on commit b8cf3d0

Please sign in to comment.