Files
curriculum/1.solar-system/3.strings/07.the-report/testing/test_solution.py

37 lines
1.0 KiB
Python

from solution import format_report
def test_apollo():
expected = (
"==============================\n"
"MISSION REPORT\n"
"==============================\n"
"Name: APOLLO\n"
"Status: ok\n"
"Location: moon\n"
"Time: 13:32\n"
"=============================="
)
assert format_report("apollo", "ok", "moon", "13:32") == expected
def test_voyager():
result = format_report("voyager", "active", "interstellar", "1977-09-05")
assert "Name: VOYAGER" in result
assert "Status: active" in result
assert "Location: interstellar" in result
assert "Time: 1977-09-05" in result
assert result.startswith("=" * 30 + "\n")
assert result.endswith("\n" + "=" * 30)
def test_perseverance():
result = format_report("perseverance", "roving", "jezero crater", "2026-05-04")
assert "Name: PERSEVERANCE" in result
assert "Location: jezero crater" in result
def test_eight_lines():
result = format_report("apollo", "ok", "moon", "13:32")
assert result.count("\n") == 7