Task: Build a tiny Python package that demonstrates PyTest's xfail behavior and provides a simple tuple utility.
What to implement
A Python module tuple_utils.py containing:
A function is_palindrome_tuple(t) -> bool that returns True if the input tuple is the same when read forward and backward (t == t[::-1]).
It should raise TypeError if the input is not a tuple.
A tests/test_tuple_utils.py file with tests:
test_is_palindrome_true: assert is_palindrome_tuple((1, 2, 3, 2, 1)) is True
test_is_palindrome_false: assert is_palindrome_tuple((1, 2, 3)) is False
Keep the existing tests/test_failing.py from the prompt, which contains:
A test marked with @pytest.mark.xfail:
def test_failing():
assert (1, 2, 3) == (3, 2, 1)
Ensure this test remains and is recognized as an expected failure (xfail) by PyTest.
A pytest.ini (or pyproject.toml) configuring PyTest to expose helpful test summaries (e.g., addopts = -ra) and recognizing the xfail marker.
A short README.md explaining:
What is being demonstrated (xfail usage in PyTest and a simple tuple utility).
How to run the tests and interpret the results.
How the new is_palindrome_tuple behaves and why the tests exist.
Deliverables (repository structure)
tuple_utils.py
tests/test_tuple_utils.py
tests/test_failing.py (as provided)
pytest.ini (or pyproject.toml) with appropriate configuration
README.md
Acceptance criteria
is_palindrome_tuple behaves as specified for both palindromic and non-palindromic tuples and raises TypeError for non-tuples.
The two new tests pass under normal PyTest execution.
The existing test_failing remains marked xfail and does not cause a hard failure of the test suite.
The configuration and README clearly document the xfail demonstration and how to run the tests.
BONUS: Complete this task as quickly as possible. Faster solutions are preferred.