New submission from Nikita Sobolev <m...@sobolevn.me>:

There are several problems in `test_descr.py` that I've found:
1. In `test_dir` there's a test case that ensure that `TypeError` is raised in 
some case: 
https://github.com/python/cpython/blame/c9dc1f491e8edb0bc433cde73190a3015d226891/Lib/test/test_descr.py#L2548-L2551
 But it never does anything if this error is not raised. So, this test can 
contain a possible problem inside. It will just skip a scenario where 
`TypeError` is not thrown.

2. The same with `test_file_failt` here: 
https://github.com/python/cpython/blame/c9dc1f491e8edb0bc433cde73190a3015d226891/Lib/test/test_descr.py#L4451-L4456
 If `RuntimeError` is not thrown - nothing happens

3. `assert 0, ...` is problematic: 
https://github.com/python/cpython/blame/c9dc1f491e8edb0bc433cde73190a3015d226891/Lib/test/test_descr.py#L4451-L4456
 It can be dropped in optimized mode and it's error message is not ideal

I will send a PR with all these problems fixed.

----------
components: Tests
messages: 410050
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Improve several exception handling practices in `test_descr.py`
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

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

Reply via email to