Advertisement
nikolask

PSET5 pytest test_fuel.py output

Aug 20th, 2023 (edited)
1,060
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.34 KB | Source Code | 0 0
  1. ============================= test session starts ==============================
  2. platform linux -- Python 3.10.12, pytest-7.4.0, pluggy-1.2.0
  3. rootdir: /home/nikolask/DropboxMain/code/Python/edx/EDX_CS50P/pset5
  4. collected 4 items
  5.  
  6. test_fuel.py FF..                                                        [100%]
  7.  
  8. =================================== FAILURES ===================================
  9. ______________________________ test_zero_division ______________________________
  10.  
  11. fraction = '1/0'
  12.  
  13.     def convert(fraction):
  14.         while True:
  15.             try:
  16.                 x = int(fraction.split(sep="/")[0])
  17.                 y = int(fraction.split(sep="/")[1])
  18.                 if x > y:
  19. >                   raise ValueError
  20. E                   ValueError
  21.  
  22. fuel.py:14: ValueError
  23.  
  24. During handling of the above exception, another exception occurred:
  25.  
  26.     def test_zero_division():
  27.         with pytest.raises(ZeroDivisionError):
  28. >           convert("1/0")
  29.  
  30. test_fuel.py:8:
  31. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  32. fuel.py:20: in convert
  33.     fraction = input("Fraction: ")
  34. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  35.  
  36. self = <_pytest.capture.DontReadFromInput object at 0x7f340c0fd7e0>, size = -1
  37.  
  38.     def read(self, size: int = -1) -> str:
  39. >       raise OSError(
  40.             "pytest: reading from stdin while output is captured!  Consider using `-s`."
  41.         )
  42. E       OSError: pytest: reading from stdin while output is captured!  Consider using `-s`.
  43.  
  44. /home/nikolask/.local/lib/python3.10/site-packages/_pytest/capture.py:202: OSError
  45. ----------------------------- Captured stdout call -----------------------------
  46. Fraction:
  47. ______________________________ test_y_less_than_x ______________________________
  48.  
  49. fraction = '3/2'
  50.  
  51.     def convert(fraction):
  52.         while True:
  53.             try:
  54.                 x = int(fraction.split(sep="/")[0])
  55.                 y = int(fraction.split(sep="/")[1])
  56.                 if x > y:
  57. >                   raise ValueError
  58. E                   ValueError
  59.  
  60. fuel.py:14: ValueError
  61.  
  62. During handling of the above exception, another exception occurred:
  63.  
  64.     def test_y_less_than_x():
  65.         with pytest.raises(ValueError):
  66. >           convert("3/2")
  67.  
  68. test_fuel.py:12:
  69. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  70. fuel.py:20: in convert
  71.     fraction = input("Fraction: ")
  72. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  73.  
  74. self = <_pytest.capture.DontReadFromInput object at 0x7f340c0fd7e0>, size = -1
  75.  
  76.     def read(self, size: int = -1) -> str:
  77. >       raise OSError(
  78.             "pytest: reading from stdin while output is captured!  Consider using `-s`."
  79.         )
  80. E       OSError: pytest: reading from stdin while output is captured!  Consider using `-s`.
  81.  
  82. /home/nikolask/.local/lib/python3.10/site-packages/_pytest/capture.py:202: OSError
  83. ----------------------------- Captured stdout call -----------------------------
  84. Fraction:
  85. =========================== short test summary info ============================
  86. FAILED test_fuel.py::test_zero_division - OSError: pytest: reading from stdin...
  87. FAILED test_fuel.py::test_y_less_than_x - OSError: pytest: reading from stdin...
  88. ========================= 2 failed, 2 passed in 0.02s ==========================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement