GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

test_bricknil.Testbricknil.test_name()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
import pytest
2
import os, sys
3
import logging
4
from asyncio import coroutine
5
6
import smtplib
7
from mock import Mock
8
from mock import patch, call
9
from mock import MagicMock
10
from mock import PropertyMock
11
12
sys.modules['bleak'] = MagicMock()
13
from  bricknil.process import Process
14
from bricknil.sensor import TrainMotor
15
16
class AsyncMock(MagicMock):
17
    async def __call__(self, *args, **kwargs):
18
        return super(AsyncMock, self).__call__(*args, **kwargs)
19
20
21
class Testbricknil:
22
23
    def setup(self):
24
        self.p = Process('test')
25
26
    def test_name(self):
27
        assert self.p.name == 'test'
28
29
    def test_increment(self):
30
        for i in range(10):
31
            p2 = Process('test2')
32
            assert self.p.id == p2.id-(i+1)
33
        assert p2.__str__() == 'test2.11'
0 ignored issues
show
introduced by
The variable p2 does not seem to be defined in case the for loop on line 30 is not entered. Are you sure this can never be the case?
Loading history...
34
        assert p2.__repr__() == 'Process("test2")'
35
36
    def test_messages(self):
37
        self.p.message('hello')
38
        self.p.message_info('hello')
39
        self.p.message_debug('hello')
40
        self.p.message_error('hello')
41
42
    @pytest.mark.curio
43
    #@patch('test_bricknil.TrainMotor.set_output', new_callable=AsyncMock)
44
    async def test_motor(self):
45
        m = TrainMotor('motor')
46
        m.set_output = Mock(side_effect=coroutine(lambda x,y :'the awaitable should return this'))
47
        await m.set_speed(10)
48
        assert m.set_output.call_args == call(0, 10)
49
50