[issue22138] patch.object doesn't restore function defaults

2015-12-01 Thread Xiadong Zhu

Xiadong Zhu added the comment:

How's the issue going on?

The situation to mock function's ``__defaults__`` attribute is general, as 
default argument is determinate after function definition, when we need to test 
a function such as:

def access_db(statement, backend=default_db_backend):
return default_db_backend.execute(statement)

that we must mock ``__defaults__`` attribute if we want to invoke it with 
default backend.

It has one year past, though I could patch the ``_patch`` class but it's dirty, 
is the issue a defect can be fixed or unsolvable?

--
nosy: +mailto1587

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22138>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



What's the difference between gevent.sleep and time.sleep?

2014-07-26 Thread Xiadong Zhu
Hi, I'm learning gevent, but I didn't found the difference with gevent.sleep 
and time.sleep, does anybody could give me a sample code to show their 
difference? Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list