Coverage for tests/fixtures/inheriting_typing_NamedTuple.py: 100.00%

6 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-03-09 17:28 +0100

1""" 

2While recursing on a class inheriting from `typing.NamedTuple`, the class' `__dict__` returns items 

3that are identified as properties. 

4 

5When trying to get the signature of these properties' `fget` methods, 

6`inspect` raises a `ValueError: callable operator.itemgetter(0) is not supported by signature` error. 

7 

8Instead of failing, we simply set the signature to `None`. 

9 

10References: 

11 

12- Test case: [tests.test_loader.test_inheriting_typing_NamedTuple][]. 

13- Issue reported at [pawamoy/pytkdocs#15](https://github.com/pawamoy/pytkdocs/issues/15). 

14- Fixed by commit [67cee40](https://github.com/pawamoy/pytkdocs/commit/67cee406baccc8789566ed72ee040728c934f49d). 

15- See other "inheriting" test cases. 

16""" 

17 

18from typing import NamedTuple 

19 

20 

21class MyNamedTupleType(NamedTuple): 

22 """My custom named tuple type docstring.""" 

23 

24 aaa: float 

25 bbb: float 

26 ccc: float 

27 ddd: float