classification
Title: Empty typing.NamedTuple creation is not tested
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lukasz.langa, miss-islington, sobolevn
Priority: normal Keywords: patch

Created on 2021-09-24 11:23 by sobolevn, last changed 2021-09-26 17:10 by lukasz.langa. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28559 merged sobolevn, 2021-09-25 08:06
PR 28570 merged miss-islington, 2021-09-26 16:32
PR 28571 merged miss-islington, 2021-09-26 16:32
Messages (5)
msg402557 - (view) Author: Nikita Sobolev (sobolevn) * Date: 2021-09-24 11:23
While working on `mypy` support of `NamedTuple`s (https://github.com/python/mypy/issues/11047), I've noticed that currently when testing `typing.NamedTuple` cases like:

1. `N = NamedTuple('N')`

and

2.

```python
class N(NamedTuple):
    ...
```

are ignored. 

However, this is an important corner-cases, we need to be sure that use can create empty named tuples if needed.

Related position in code: https://github.com/python/cpython/blob/3f8b23f8ddab75d9b77a3997d54e663187e12cc8/Lib/test/test_typing.py#L4102-L4114

I will send a PR add these two cases.
msg402669 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-26 16:32
New changeset f56268a2cd38b3fe2be1e4361d3d8b581e73559b by Nikita Sobolev in branch 'main':
bpo-45280: Add test for empty `NamedTuple` in `test_typing` (GH-28559)
https://github.com/python/cpython/commit/f56268a2cd38b3fe2be1e4361d3d8b581e73559b
msg402672 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-26 17:09
New changeset 08e387ab82331230d7f6608e949723d8a8e09229 by Miss Islington (bot) in branch '3.9':
bpo-45280: Add test for empty `NamedTuple` in `test_typing` (GH-28559) (GH-28570)
https://github.com/python/cpython/commit/08e387ab82331230d7f6608e949723d8a8e09229
msg402673 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-26 17:09
New changeset d452b2963ba91d6bce29bb96733ed8bd1c0448b0 by Miss Islington (bot) in branch '3.10':
bpo-45280: Add test for empty `NamedTuple` in `test_typing` (GH-28559) (GH-28571)
https://github.com/python/cpython/commit/d452b2963ba91d6bce29bb96733ed8bd1c0448b0
msg402674 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-26 17:10
Thanks, Nikita! ✨ 🍰 ✨
History
Date User Action Args
2021-09-26 17:10:10lukasz.langasetstatus: open -> closed
resolution: fixed
messages: + msg402674

stage: patch review -> resolved
2021-09-26 17:09:53lukasz.langasetmessages: + msg402673
2021-09-26 17:09:33lukasz.langasetmessages: + msg402672
2021-09-26 16:32:54miss-islingtonsetpull_requests: + pull_request26954
2021-09-26 16:32:50miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request26953
2021-09-26 16:32:26lukasz.langasetnosy: + lukasz.langa
messages: + msg402669
2021-09-25 08:06:20sobolevnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request26942
2021-09-24 11:23:41sobolevncreate