Vlad5080

2sprint project calculator ERRORS PYTEST

Jul 10th, 2021
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.65 KB | None | 0 0
  1. ================= test session starts =================
  2. platform linux -- Python 3.8.10, pytest-5.3.2, py-1.10.0, pluggy-0.13.1 -- /home/fill/Study/2 sprint/hw_python_oop/venv/bin/python
  3. rootdir: /home/fill/Study/2 sprint/hw_python_oop, inifile: pytest.ini, testpaths: tests/
  4. collected 20 items
  5.  
  6. tests/test_homework.py::TestRecord::test_init[kwargs0] PASSED [ 5%]
  7. tests/test_homework.py::TestRecord::test_init[kwargs1] PASSED [ 10%]
  8. tests/test_homework.py::TestCalculator::test_init PASSED [ 15%]
  9. tests/test_homework.py::TestCalculator::test_add_record PASSED [ 20%]
  10. tests/test_homework.py::TestCalculator::test_get_today_stats PASSED [ 25%]
  11. tests/test_homework.py::TestCalculator::test_get_week_stats FAILED [ 30%]
  12. tests/test_homework.py::TestCalculator::test_get_calories_remained PASSED [ 35%]
  13. tests/test_homework.py::TestCalculator::test_get_today_cash_remained PASSED [ 40%]
  14. tests/test_homework.py::TestCaloriesCalculator::test_init PASSED [ 45%]
  15. tests/test_homework.py::TestCaloriesCalculator::test_get_calories_remained PASSED [ 50%]
  16. tests/test_homework.py::TestCashCalculator::test_init FAILED [ 55%]
  17. tests/test_homework.py::TestCashCalculator::test_get_today_cash_remained[0-usd] FAILED [ 60%]
  18. tests/test_homework.py::TestCashCalculator::test_get_today_cash_remained[0-eur] FAILED [ 65%]
  19. tests/test_homework.py::TestCashCalculator::test_get_today_cash_remained[0-rub] FAILED [ 70%]
  20. tests/test_homework.py::TestCashCalculator::test_get_today_cash_remained[1-usd] FAILED [ 75%]
  21. tests/test_homework.py::TestCashCalculator::test_get_today_cash_remained[1-eur] FAILED [ 80%]
  22. tests/test_homework.py::TestCashCalculator::test_get_today_cash_remained[1-rub] FAILED [ 85%]
  23. tests/test_homework.py::TestCashCalculator::test_get_today_cash_remained[-1-usd] FAILED [ 90%]
  24. tests/test_homework.py::TestCashCalculator::test_get_today_cash_remained[-1-eur] FAILED [ 95%]
  25. tests/test_homework.py::TestCashCalculator::test_get_today_cash_remained[-1-rub] FAILED [100%]
  26.  
  27. ====================== FAILURES =======================
  28. _________ TestCalculator.test_get_week_stats __________
  29.  
  30. self = <test_homework.TestCalculator object at 0x7feb58b77520>
  31. init_limit = 2500
  32. data_records = ([<homework.Record object at 0x7feb58b3f8e0>, <homework.Record object at 0x7feb58b3fc10>, <homework.Record object at 0...feb58b3fd90>, <homework.Record object at 0x7feb58b3fbb0>, <homework.Record object at 0x7feb58b3fb50>, ...], 1350, 2400)
  33. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58b72f70>
  34.  
  35. def test_get_week_stats(self, init_limit, data_records, msg_err):
  36. result = homework.Calculator(init_limit)
  37. records, today, week = data_records
  38. for record in records:
  39. result.add_record(record)
  40. assert hasattr(result, 'get_week_stats'), msg_err('add_method', 'get_week_stats', 'Calculator')
  41. > assert result.get_week_stats() == week, msg_err('wrong_method', 'get_week_stats', 'Calculator')
  42. E AssertionError: Проверьте правильность работы метода `get_week_stats()` у класса `Calculator`
  43. E assert 'За неделю с 2021-07-04 по 2021-07-10 было потрачено: 2400' == 2400
  44. E -'За неделю с 2021-07-04 по 2021-07-10 было потрачено: 2400'
  45. E +2400
  46.  
  47. tests/test_homework.py:73: AssertionError
  48. ____________ TestCashCalculator.test_init _____________
  49.  
  50. self = <test_homework.TestCashCalculator object at 0x7feb58b26b80>
  51. init_limit = 2500
  52. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58b72ca0>
  53.  
  54. def test_init(self, init_limit, msg_err):
  55. assert hasattr(homework, 'CashCalculator'), (
  56. msg_err('add_class', 'CashCalculator', child=True, parent_name='Calculator')
  57. )
  58. > result = homework.CashCalculator(init_limit)
  59. E TypeError: __init__() takes 1 positional argument but 2 were given
  60.  
  61. tests/test_homework.py:136: TypeError
  62. _ TestCashCalculator.test_get_today_cash_remained[0-usd] _
  63.  
  64. self = <test_homework.TestCashCalculator object at 0x7feb58b3fac0>
  65. init_limit = 2500
  66. data_records = ([<homework.Record object at 0x7feb58b263a0>, <homework.Record object at 0x7feb58b3fca0>, <homework.Record object at 0...7feb58b26340>, <homework.Record object at 0x7feb58b260a0>, <homework.Record object at 0x7feb58b3fa30>, ...], 900, 1650)
  67. amount = 0, currency = 'usd'
  68. today_cash_remained = <function today_cash_remained.<locals>._today_cash_remained at 0x7feb58b72c10>
  69. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58b72f70>
  70. monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7feb58b26250>
  71.  
  72. @pytest.mark.parametrize("amount,currency", [
  73. (0, 'usd'), (0, 'eur'), (0, 'rub'),
  74. (1, 'usd'), (1, 'eur'), (1, 'rub'),
  75. (-1, 'usd'), (-1, 'eur'), (-1, 'rub')
  76. ])
  77. def test_get_today_cash_remained(self, init_limit, data_records, amount, currency, today_cash_remained, msg_err,
  78. monkeypatch):
  79. > result = homework.CashCalculator(init_limit)
  80. E TypeError: __init__() takes 1 positional argument but 2 were given
  81.  
  82. tests/test_homework.py:157: TypeError
  83. _ TestCashCalculator.test_get_today_cash_remained[0-eur] _
  84.  
  85. self = <test_homework.TestCashCalculator object at 0x7feb58a9c610>
  86. init_limit = 2500
  87. data_records = ([<homework.Record object at 0x7feb58a9ce50>, <homework.Record object at 0x7feb58a9c6a0>, <homework.Record object at 0...feb58a9c370>, <homework.Record object at 0x7feb58a9cac0>, <homework.Record object at 0x7feb58a98a00>, ...], 1350, 2850)
  88. amount = 0, currency = 'eur'
  89. today_cash_remained = <function today_cash_remained.<locals>._today_cash_remained at 0x7feb58a71160>
  90. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58a711f0>
  91. monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7feb58a98d00>
  92.  
  93. @pytest.mark.parametrize("amount,currency", [
  94. (0, 'usd'), (0, 'eur'), (0, 'rub'),
  95. (1, 'usd'), (1, 'eur'), (1, 'rub'),
  96. (-1, 'usd'), (-1, 'eur'), (-1, 'rub')
  97. ])
  98. def test_get_today_cash_remained(self, init_limit, data_records, amount, currency, today_cash_remained, msg_err,
  99. monkeypatch):
  100. > result = homework.CashCalculator(init_limit)
  101. E TypeError: __init__() takes 1 positional argument but 2 were given
  102.  
  103. tests/test_homework.py:157: TypeError
  104. _ TestCashCalculator.test_get_today_cash_remained[0-rub] _
  105.  
  106. self = <test_homework.TestCashCalculator object at 0x7feb58aa79d0>
  107. init_limit = 2500
  108. data_records = ([<homework.Record object at 0x7feb58aa73d0>, <homework.Record object at 0x7feb58aa7e80>, <homework.Record object at 0...feb58aa7a00>, <homework.Record object at 0x7feb58aa7d90>, <homework.Record object at 0x7feb58a988b0>, ...], 1500, 3000)
  109. amount = 0, currency = 'rub'
  110. today_cash_remained = <function today_cash_remained.<locals>._today_cash_remained at 0x7feb58a71430>
  111. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58a714c0>
  112. monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7feb58a98fd0>
  113.  
  114. @pytest.mark.parametrize("amount,currency", [
  115. (0, 'usd'), (0, 'eur'), (0, 'rub'),
  116. (1, 'usd'), (1, 'eur'), (1, 'rub'),
  117. (-1, 'usd'), (-1, 'eur'), (-1, 'rub')
  118. ])
  119. def test_get_today_cash_remained(self, init_limit, data_records, amount, currency, today_cash_remained, msg_err,
  120. monkeypatch):
  121. > result = homework.CashCalculator(init_limit)
  122. E TypeError: __init__() takes 1 positional argument but 2 were given
  123.  
  124. tests/test_homework.py:157: TypeError
  125. _ TestCashCalculator.test_get_today_cash_remained[1-usd] _
  126.  
  127. self = <test_homework.TestCashCalculator object at 0x7feb58aa9670>
  128. init_limit = 2500
  129. data_records = ([<homework.Record object at 0x7feb58aa97f0>, <homework.Record object at 0x7feb58ab0760>, <homework.Record object at 0...feb58aa9220>, <homework.Record object at 0x7feb58aa9fd0>, <homework.Record object at 0x7feb58ab07c0>, ...], 1350, 2550)
  130. amount = 1, currency = 'usd'
  131. today_cash_remained = <function today_cash_remained.<locals>._today_cash_remained at 0x7feb58a71790>
  132. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58a71820>
  133. monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7feb58ab0a60>
  134.  
  135. @pytest.mark.parametrize("amount,currency", [
  136. (0, 'usd'), (0, 'eur'), (0, 'rub'),
  137. (1, 'usd'), (1, 'eur'), (1, 'rub'),
  138. (-1, 'usd'), (-1, 'eur'), (-1, 'rub')
  139. ])
  140. def test_get_today_cash_remained(self, init_limit, data_records, amount, currency, today_cash_remained, msg_err,
  141. monkeypatch):
  142. > result = homework.CashCalculator(init_limit)
  143. E TypeError: __init__() takes 1 positional argument but 2 were given
  144.  
  145. tests/test_homework.py:157: TypeError
  146. _ TestCashCalculator.test_get_today_cash_remained[1-eur] _
  147.  
  148. self = <test_homework.TestCashCalculator object at 0x7feb58a876a0>
  149. init_limit = 2500
  150. data_records = ([<homework.Record object at 0x7feb58a9c550>, <homework.Record object at 0x7feb58a87100>, <homework.Record object at 0...feb58a9ca60>, <homework.Record object at 0x7feb58a87b50>, <homework.Record object at 0x7feb58a87e20>, ...], 1350, 2700)
  151. amount = 1, currency = 'eur'
  152. today_cash_remained = <function today_cash_remained.<locals>._today_cash_remained at 0x7feb58a71b80>
  153. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58a71ca0>
  154. monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7feb58a9cac0>
  155.  
  156. @pytest.mark.parametrize("amount,currency", [
  157. (0, 'usd'), (0, 'eur'), (0, 'rub'),
  158. (1, 'usd'), (1, 'eur'), (1, 'rub'),
  159. (-1, 'usd'), (-1, 'eur'), (-1, 'rub')
  160. ])
  161. def test_get_today_cash_remained(self, init_limit, data_records, amount, currency, today_cash_remained, msg_err,
  162. monkeypatch):
  163. > result = homework.CashCalculator(init_limit)
  164. E TypeError: __init__() takes 1 positional argument but 2 were given
  165.  
  166. tests/test_homework.py:157: TypeError
  167. _ TestCashCalculator.test_get_today_cash_remained[1-rub] _
  168.  
  169. self = <test_homework.TestCashCalculator object at 0x7feb58b3fe20>
  170. init_limit = 2500
  171. data_records = ([<homework.Record object at 0x7feb58b3fdf0>, <homework.Record object at 0x7feb58a98cd0>, <homework.Record object at 0...feb58b8f850>, <homework.Record object at 0x7feb58b3fd90>, <homework.Record object at 0x7feb58a987f0>, ...], 1050, 2400)
  172. amount = 1, currency = 'rub'
  173. today_cash_remained = <function today_cash_remained.<locals>._today_cash_remained at 0x7feb58a719d0>
  174. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58a71f70>
  175. monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7feb58a98af0>
  176.  
  177. @pytest.mark.parametrize("amount,currency", [
  178. (0, 'usd'), (0, 'eur'), (0, 'rub'),
  179. (1, 'usd'), (1, 'eur'), (1, 'rub'),
  180. (-1, 'usd'), (-1, 'eur'), (-1, 'rub')
  181. ])
  182. def test_get_today_cash_remained(self, init_limit, data_records, amount, currency, today_cash_remained, msg_err,
  183. monkeypatch):
  184. > result = homework.CashCalculator(init_limit)
  185. E TypeError: __init__() takes 1 positional argument but 2 were given
  186.  
  187. tests/test_homework.py:157: TypeError
  188. _ TestCashCalculator.test_get_today_cash_remained[-1-usd] _
  189.  
  190. self = <test_homework.TestCashCalculator object at 0x7feb58ab0a00>
  191. init_limit = 2500
  192. data_records = ([<homework.Record object at 0x7feb58ab0fa0>, <homework.Record object at 0x7feb58aac4f0>, <homework.Record object at 0...feb58ab0d00>, <homework.Record object at 0x7feb58ab0490>, <homework.Record object at 0x7feb58ab0580>, ...], 1350, 2850)
  193. amount = -1, currency = 'usd'
  194. today_cash_remained = <function today_cash_remained.<locals>._today_cash_remained at 0x7feb58a71dc0>
  195. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58a711f0>
  196. monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7feb58aace50>
  197.  
  198. @pytest.mark.parametrize("amount,currency", [
  199. (0, 'usd'), (0, 'eur'), (0, 'rub'),
  200. (1, 'usd'), (1, 'eur'), (1, 'rub'),
  201. (-1, 'usd'), (-1, 'eur'), (-1, 'rub')
  202. ])
  203. def test_get_today_cash_remained(self, init_limit, data_records, amount, currency, today_cash_remained, msg_err,
  204. monkeypatch):
  205. > result = homework.CashCalculator(init_limit)
  206. E TypeError: __init__() takes 1 positional argument but 2 were given
  207.  
  208. tests/test_homework.py:157: TypeError
  209. _ TestCashCalculator.test_get_today_cash_remained[-1-eur] _
  210.  
  211. self = <test_homework.TestCashCalculator object at 0x7feb58a9c310>
  212. init_limit = 2500
  213. data_records = ([<homework.Record object at 0x7feb58ac38b0>, <homework.Record object at 0x7feb58ac3850>, <homework.Record object at 0...feb58a9c2e0>, <homework.Record object at 0x7feb58a9c160>, <homework.Record object at 0x7feb58a9cd30>, ...], 1350, 2100)
  214. amount = -1, currency = 'eur'
  215. today_cash_remained = <function today_cash_remained.<locals>._today_cash_remained at 0x7feb58b64ee0>
  216. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58b64f70>
  217. monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7feb58ac3520>
  218.  
  219. @pytest.mark.parametrize("amount,currency", [
  220. (0, 'usd'), (0, 'eur'), (0, 'rub'),
  221. (1, 'usd'), (1, 'eur'), (1, 'rub'),
  222. (-1, 'usd'), (-1, 'eur'), (-1, 'rub')
  223. ])
  224. def test_get_today_cash_remained(self, init_limit, data_records, amount, currency, today_cash_remained, msg_err,
  225. monkeypatch):
  226. > result = homework.CashCalculator(init_limit)
  227. E TypeError: __init__() takes 1 positional argument but 2 were given
  228.  
  229. tests/test_homework.py:157: TypeError
  230. _ TestCashCalculator.test_get_today_cash_remained[-1-rub] _
  231.  
  232. self = <test_homework.TestCashCalculator object at 0x7feb58ab9580>
  233. init_limit = 2500
  234. data_records = ([<homework.Record object at 0x7feb58ab9520>, <homework.Record object at 0x7feb58ab9ee0>, <homework.Record object at 0...feb58ab9be0>, <homework.Record object at 0x7feb58ab77c0>, <homework.Record object at 0x7feb58ab7700>, ...], 1050, 2250)
  235. amount = -1, currency = 'rub'
  236. today_cash_remained = <function today_cash_remained.<locals>._today_cash_remained at 0x7feb58a710d0>
  237. msg_err = <function msg_err.<locals>._msg_err at 0x7feb58a71280>
  238. monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7feb58ab7640>
  239.  
  240. @pytest.mark.parametrize("amount,currency", [
  241. (0, 'usd'), (0, 'eur'), (0, 'rub'),
  242. (1, 'usd'), (1, 'eur'), (1, 'rub'),
  243. (-1, 'usd'), (-1, 'eur'), (-1, 'rub')
  244. ])
  245. def test_get_today_cash_remained(self, init_limit, data_records, amount, currency, today_cash_remained, msg_err,
  246. monkeypatch):
  247. > result = homework.CashCalculator(init_limit)
  248. E TypeError: __init__() takes 1 positional argument but 2 were given
  249.  
  250. tests/test_homework.py:157: TypeError
  251. ============ 11 failed, 9 passed in 0.23s =============
Advertisement
Add Comment
Please, Sign In to add comment