Created
May 11, 2020 15:40
-
-
Save zed/9fd5322932b814278547819f23bc0b6c to your computer and use it in GitHub Desktop.
Revisions
-
zed created this gist
May 11, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ #!/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()