[issue32952] Add __qualname__ for attributes of Mock instances

2018-02-25 Thread Sergey Kostyuk

New submission from Sergey Kostyuk <ks.hot...@gmail.com>:

Good day. I have a question (or proposal, if you like)

For now Mocks from unittest.mock module allows to mimic an interface of a some 
class or object instance. They pass isinstance checks, they allows to wrap 
callables with respect to their arguments. But there is a thing they don't 
mimic: a value of the __qualname__ attribute for a mock itself and its mocked 
attributes.

So, here is the proposal: copy the value of __qualname__ attribute from the 
wrapped (mocked) instance for all of the attributes of a Mock.

I don't know if it's reasonable enough to be implemented at all but it can be 
handy in some situations.

An example of the current and desired behaviour is provided in the attached 
file. And sorry for my English

--
components: Tests
files: qualname_for_mocks.py
messages: 312849
nosy: s_kostyuk
priority: normal
severity: normal
status: open
title: Add __qualname__ for attributes of Mock instances
type: enhancement
versions: Python 3.8
Added file: https://bugs.python.org/file47462/qualname_for_mocks.py

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



[issue31059] asyncio.StreamReader.read hangs if n<0

2017-07-27 Thread Sergey Kostyuk

New submission from Sergey Kostyuk:

Good day

Maybe I misunderstood something, but I'm failed to fetch any data by calling 
asyncio.StreamReader.read if `n` is less than zero (or left default). It just 
hangs in the loop forever (see line number 614 of asyncio/streams.py: 
https://github.com/python/cpython/blob/3e56ff0/Lib/asyncio/streams.py#L614). If 
`n` is equal to any positive value - coroutine works as expected and returns if 
there is any data in socket buffer. Even if available data size is less than 
`n` bytes.

Expected behavior: collect all data from the buffer and return
Current behavior: hangs in the loop forever if n < 0

My usage sample: https://git.io/v7nJq

--
components: asyncio
messages: 299332
nosy: Sergey Kostyuk, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.StreamReader.read hangs if n<0
type: behavior
versions: Python 3.5

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