chore: initialize containerized Python learning workbook (2026 DevOps/SRE)
This commit is contained in:
commit
ae4c421815
63 files changed
+1273
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import pytest
|
||||
from basics import celsius_to_fahrenheit, classify_score, fizzbuzz_label, sum_up_to
|
||||
|
||||
|
||||
def test_celsius_to_fahrenheit() -> None:
|
||||
assert celsius_to_fahrenheit(0.0) == pytest.approx(32.0)
|
||||
assert celsius_to_fahrenheit(100.0) == pytest.approx(212.0)
|
||||
assert celsius_to_fahrenheit(-40.0) == pytest.approx(-40.0)
|
||||
|
||||
|
||||
def test_classify_score() -> None:
|
||||
assert classify_score(0) == "fail"
|
||||
assert classify_score(50) == "pass"
|
||||
assert classify_score(80) == "good"
|
||||
assert classify_score(95) == "excellent"
|
||||
assert classify_score(101) == "invalid"
|
||||
assert classify_score(-1) == "invalid"
|
||||
|
||||
|
||||
def test_sum_up_to() -> None:
|
||||
assert sum_up_to(0) == 0
|
||||
assert sum_up_to(-5) == 0
|
||||
assert sum_up_to(10) == 55
|
||||
|
||||
|
||||
def test_fizzbuzz_label() -> None:
|
||||
assert fizzbuzz_label(1) == "1"
|
||||
assert fizzbuzz_label(3) == "Fizz"
|
||||
assert fizzbuzz_label(5) == "Buzz"
|
||||
assert fizzbuzz_label(15) == "FizzBuzz"
|
||||
Reference in new issue
Block a user