Coverage for pyfields/tests/issues/test_issue_81.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-11-06 16:35 +0000

1# Authors: Sylvain MARIE <sylvain.marie@se.com> 

2# + All contributors to <https://github.com/smarie/python-pyfields> 

3# 

4# License: 3-clause BSD, <https://github.com/smarie/python-pyfields/blob/master/LICENSE> 

5import sys 

6import pytest 

7 

8 

9@pytest.mark.skipif(sys.version_info < (3, 6), reason="class member annotations are not supported in python < 3.6") 

10def test_issue_81(): 

11 """ See https://github.com/smarie/python-pyfields/issues/81 """ 

12 from ._test_py36 import test_issue_81 

13 A, B = test_issue_81() 

14 

15 # before the bug fix, B.a was mistakenyl recreated py autofields as an overridden mandatory field on B 

16 assert B.a.is_mandatory is False 

17 # this was therefore raising a "Missing required positional argument" error on the generated constructor 

18 B(b=3)