| Total Complexity | 10 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from yfrake.client.return_types.base_response import BaseResponse |
||
| 2 | import asyncio |
||
| 3 | import pytest |
||
| 4 | import sys |
||
| 5 | |||
| 6 | |||
| 7 | if sys.platform == 'win32': |
||
| 8 | asyncio.set_event_loop_policy( |
||
| 9 | asyncio.WindowsSelectorEventLoopPolicy() |
||
| 10 | ) |
||
| 11 | |||
| 12 | |||
| 13 | def test_resp_attributes(): |
||
| 14 | resp = BaseResponse() |
||
| 15 | assert resp.endpoint is None |
||
| 16 | assert resp.error is None |
||
| 17 | assert resp.data is None |
||
| 18 | |||
| 19 | |||
| 20 | def test_resp_endpoint_exceptions(): |
||
| 21 | resp = BaseResponse() |
||
| 22 | with pytest.raises(TypeError): |
||
| 23 | resp.endpoint = str() |
||
| 24 | with pytest.raises(TypeError): |
||
| 25 | del resp.endpoint |
||
| 26 | |||
| 27 | |||
| 28 | def test_resp_error_exceptions(): |
||
| 29 | resp = BaseResponse() |
||
| 30 | with pytest.raises(TypeError): |
||
| 31 | resp.error = dict() |
||
| 32 | with pytest.raises(TypeError): |
||
| 33 | del resp.error |
||
| 34 | |||
| 35 | |||
| 36 | def test_resp_data_exceptions(): |
||
| 37 | resp = BaseResponse() |
||
| 38 | with pytest.raises(TypeError): |
||
| 39 | resp.data = dict() |
||
| 40 | with pytest.raises(TypeError): |
||
| 41 | del resp.data |
||
| 42 |