Last active
October 27, 2025 02:36
-
-
Save mcsee/c3ebcb1eb3c135cf3760036de1d29245 to your computer and use it in GitHub Desktop.
This gist belongs to Clean Code Cookbook http://cleancodecookbook.com By Maximiliano Contieri http://maximilianocontieri.com
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
| def test_set_speed(): | |
| car = Formula1Car("Red Bull") | |
| car.set_speed(320) | |
| assert car.speed == 320, ( | |
| f"Expected speed to be 320 km/h, " | |
| f"but got {car.speed} km/h" | |
| ) | |
| def test_accelerate(): | |
| car = Formula1Car("Red Bull") | |
| car.set_speed(320) | |
| car.accelerate(10) | |
| assert car.speed == 330, ( | |
| f"Expected speed to be 330 km/h " | |
| f"after accelerating by 10, " | |
| f"but got {car.speed} km/h" | |
| ) | |
| def test_brake(): | |
| car = Formula1Car("Red Bull") | |
| car.set_speed(330) | |
| car.brake(50) | |
| assert car.speed == 280, ( | |
| f"Expected speed to be 280 km/h " | |
| f"after braking by 50, " | |
| f"but got {car.speed} km/h" | |
| ) | |
| def test_change_tire(): | |
| car = Formula1Car("Red Bull") | |
| car.change_tire("soft") | |
| assert car.tire == "soft", ( | |
| f"Expected tire type to be 'soft', " | |
| f"but got '{car.tire}'" | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment