Fixture-Based List Tests
Write a fixture-style function sample_numbers() that provides a list of numbers, then use it in two separate checks: one testing the sum, one testing the length — mirroring pytest's @pytest.fixture pattern.
Approach: sample_numbers() returns the given list of numbers (this stands in for a @pytest.fixture, providing reusable data to multiple tests). Two separate checks then reuse it: one asserts the sum, one asserts the length.
Input: One line: 5 space-separated numbers.
Output: Two lines: test_sum: PASS then test_length: PASS.
10 20 30 40 50
test_sum: PASS test_length: PASS
- Exactly 5 numbers are given.
Hint 1
A fixture is just reusable setup code — here, sample_numbers() plays that role by returning the same list to any test that calls it.
Hint 2
sum(sample_numbers()) and len(sample_numbers()) are the two things to check.
Hint 3
Print each PASS message only after its assert has succeeded.
samplenumbers() plays the role of a pytest fixture — a function that supplies the same reusable data to every test that needs it, instead of each test redefining its own list. testsum checks sum(samplenumbers()) against the real sum; testlength checks len(sample_numbers()) against 5 — both printing PASS once their assertion holds, exactly like two separate test functions sharing one fixture would.