[New-bugs-announce] [issue46418] Simplify `MODULE` variable in `test_enum.py`

Nikita Sobolev report at bugs.python.org
Mon Jan 17 13:50:15 EST 2022


New submission from Nikita Sobolev <mail at sobolevn.me>:

Right now `MODULE` in Lib/test/test_enum.py is defined as:

```python
MODULE = ('test.test_enum', '__main__')[__name__=='__main__'] 
```

I dived into history and did not find any reasoning why it should not be just `__name__`. (But, I might had missed it: the first usage of it is dated back to 2016)

This came up in https://github.com/python/cpython/pull/30641

So, I think it is a good idea to simplify it like this:

```python
MODULE = __name__
```

Probably, this won't cause any more confusion in the future :)

I am not going to change all `MODULE` usages to `__name__` to keep the diff as minimal as possible.

----------
components: Tests
messages: 410818
nosy: ethan.furman, sobolevn
priority: normal
severity: normal
status: open
title: Simplify `MODULE` variable in `test_enum.py`
type: behavior
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46418>
_______________________________________


More information about the New-bugs-announce mailing list