Created
May 11, 2020 15:40
-
-
Save zed/9fd5322932b814278547819f23bc0b6c to your computer and use it in GitHub Desktop.
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 characters
#!/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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment