#!/usr/bin/env python3 """ https://www.youtube.com/watch?v=BleOgPhsdfc """ from dataclasses import dataclass @dataclass class RedLightViolation: """...""" place: str seconds: float def serious(self) -> bool: return self.seconds >= 1 @dataclass class SpeedViolation: """...""" place: str excess_speed: int def serious(self) -> bool: return self.excess_speed > 5 def test_serious(): """...""" assert RedLightViolation(place="Borg", seconds=1).serious() assert SpeedViolation(place="main street", excess_speed=10).serious()