test_base_response   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 10

4 Functions

Rating   Name   Duplication   Size   Complexity  
A test_resp_attributes() 0 5 1
A test_resp_data_exceptions() 0 6 3
A test_resp_endpoint_exceptions() 0 6 3
A test_resp_error_exceptions() 0 6 3
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