Coverage for src/counter_os/domain/value_objects/count.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.17.5, created at 2026-11-29 14:36 -0600

1from dataclasses import dataclass 

2 

3from counter_os.domain.exceptions import ( 

4 CountCannotBeGreaterThan100, 

5 CountCannotBeNegative, 

6) 

7 

8 

9@dataclass(frozen=True) 

10class Count: 

11 value: int 

12 

13 def __post_init__(self) -> None: 

14 if type(self.value) != int: 

15 raise TypeError("Count must be an integer") 

16 if self.value < 0: 

17 raise CountCannotBeNegative("Count cannot be less than 0") 

18 if self.value > 100: 

19 raise CountCannotBeGreaterThan100("Count cannot be greater than 100")