Coverage for stricto/bool.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-02-06 23:10 +0100

1"""Module providing the Bool() Class""" 

2from .generic import GenericType 

3from .error import Error, ErrorType 

4 

5 

6class Bool(GenericType): 

7 """ 

8 A Boolean type 

9 """ 

10 

11 def __init__(self, **kwargs): 

12 """ 

13 available arguments 

14 

15 

16 """ 

17 GenericType.__init__(self, **kwargs) 

18 

19 def check_type(self, value): 

20 if isinstance(value, (bool, Bool)): 

21 return True 

22 raise Error(ErrorType.WRONGTYPE, "Must be a bool", self.path_name()) 

23 

24 def check_constraints(self, value): 

25 

26 GenericType.check_constraints(self, value) 

27 

28 return True