Skip to content

Instantly share code, notes, and snippets.

@zed
Created May 11, 2020 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zed/9fd5322932b814278547819f23bc0b6c to your computer and use it in GitHub Desktop.
Save zed/9fd5322932b814278547819f23bc0b6c to your computer and use it in GitHub Desktop.
#!/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