Properties with pyDoubles

32 views
Skip to first unread message

Miguel Angel

unread,
May 6, 2012, 12:09:38 PM5/6/12
to pydo...@googlegroups.com
Hello!!

I have just realized that pyDoubles doesn't work with properties.

I added to "Collaborator" the next methods:
def getter(self):
  return None

def setter(self, value):
  pass

prop = property(getter, setter)

Then, I added the next tests to ProxySpyTests:
def test_works_with_property_getter(self):
  ignoreme = self.spy.prop
  assert_that_method(self.spy.getter).was_called()

def test_works_with_property_setter(self):
  self.spy.prop = 'example'
  assert_that_method(self.spy.setter).was_called().with_args('example')

Both of them fails.

So I'm affraid that pyDoubles do not support properties. I will try to solve this problem in... 2 weeks. I'm a little busy till then.

Please, tell me if I did something wrong.

Thank you

--
Miguel Ángel García Martínez

Carlos Ble

unread,
May 6, 2012, 3:21:14 PM5/6/12
to pydo...@googlegroups.com

Correct :-) it doesnt.
Thanks man

David Villa

unread,
May 7, 2012, 8:00:18 AM5/7/12
to pydo...@googlegroups.com
I fact, I do not known any python mock framework supporting properties.

Cheers

David Villa

unread,
May 7, 2012, 8:01:36 AM5/7/12
to pydo...@googlegroups.com
mmm, please, if you can, write a wish-test for this feature.

Thanks

David Villa Alises

unread,
Sep 11, 2012, 11:24:05 AM9/11/12
to pydo...@googlegroups.com
HI Miguel:

Last version of doublex (0.6) supports property stubbing, spies and mocks. You can see some simple examples at [1] and tests [2]

Feedback is welcomed.

Cheers

[1] https://bitbucket.org/DavidVilla/python-doublex/src/tip/README.rst
[2] https://bitbucket.org/DavidVilla/python-doublex/src/701d5e5ca9a3/test/unit_tests.py#cl-680
Reply all
Reply to author
Forward
0 new messages