Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ============================= test session starts ==============================
- platform linux -- Python 3.10.12, pytest-7.4.0, pluggy-1.2.0
- rootdir: /home/nikolask/DropboxMain/code/Python/edx/EDX_CS50P/pset5
- collected 4 items
- test_fuel.py FF.. [100%]
- =================================== FAILURES ===================================
- ______________________________ test_zero_division ______________________________
- fraction = '1/0'
- def convert(fraction):
- while True:
- try:
- x = int(fraction.split(sep="/")[0])
- y = int(fraction.split(sep="/")[1])
- if x > y:
- > raise ValueError
- E ValueError
- fuel.py:14: ValueError
- During handling of the above exception, another exception occurred:
- def test_zero_division():
- with pytest.raises(ZeroDivisionError):
- > convert("1/0")
- test_fuel.py:8:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- fuel.py:20: in convert
- fraction = input("Fraction: ")
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <_pytest.capture.DontReadFromInput object at 0x7f340c0fd7e0>, size = -1
- def read(self, size: int = -1) -> str:
- > raise OSError(
- "pytest: reading from stdin while output is captured! Consider using `-s`."
- )
- E OSError: pytest: reading from stdin while output is captured! Consider using `-s`.
- /home/nikolask/.local/lib/python3.10/site-packages/_pytest/capture.py:202: OSError
- ----------------------------- Captured stdout call -----------------------------
- Fraction:
- ______________________________ test_y_less_than_x ______________________________
- fraction = '3/2'
- def convert(fraction):
- while True:
- try:
- x = int(fraction.split(sep="/")[0])
- y = int(fraction.split(sep="/")[1])
- if x > y:
- > raise ValueError
- E ValueError
- fuel.py:14: ValueError
- During handling of the above exception, another exception occurred:
- def test_y_less_than_x():
- with pytest.raises(ValueError):
- > convert("3/2")
- test_fuel.py:12:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- fuel.py:20: in convert
- fraction = input("Fraction: ")
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <_pytest.capture.DontReadFromInput object at 0x7f340c0fd7e0>, size = -1
- def read(self, size: int = -1) -> str:
- > raise OSError(
- "pytest: reading from stdin while output is captured! Consider using `-s`."
- )
- E OSError: pytest: reading from stdin while output is captured! Consider using `-s`.
- /home/nikolask/.local/lib/python3.10/site-packages/_pytest/capture.py:202: OSError
- ----------------------------- Captured stdout call -----------------------------
- Fraction:
- =========================== short test summary info ============================
- FAILED test_fuel.py::test_zero_division - OSError: pytest: reading from stdin...
- FAILED test_fuel.py::test_y_less_than_x - OSError: pytest: reading from stdin...
- ========================= 2 failed, 2 passed in 0.02s ==========================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement