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

11 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# 

3# Copyright (c) Schneider Electric Industries, 2019. All right reserved. 

4 

5from pyfields import field, init_fields, get_field 

6 

7 

8def test_issue_53(): 

9 

10 class A(object): 

11 a = field(str, check_type=True) 

12 

13 @init_fields() 

14 def __init__(self): 

15 pass 

16 

17 class B(A): 

18 b = field(str, check_type=True) 

19 

20 @init_fields() 

21 def __init__(self): 

22 super(B, self).__init__(a=self.a) 

23 

24 # note that with the issue, this was raising an exception 

25 print(B('a', 'b'))