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.
Completed
Push — master ( 0254c9...47ea54 )
by
unknown
01:26
created

test_equality_by_id()   A

Complexity

Conditions 3

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
import gc
2
from unittest import mock
3
4
from trueskill import Rating
0 ignored issues
show
Configuration introduced by
The import trueskill could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
5
6
from faf.factions import Faction
0 ignored issues
show
Configuration introduced by
The import faf.factions could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
7
from server.players import Player
8
9
10
def test_ratings():
11
    p = Player('Schroedinger')
12
    p.global_rating = (1500, 20)
13
    assert p.global_rating == (1500, 20)
14
    p.global_rating = Rating(1700, 20)
15
    assert p.global_rating == (1700, 20)
16
    p.ladder_rating = (1200, 20)
17
    assert p.ladder_rating == (1200, 20)
18
    p.ladder_rating = Rating(1200, 20)
19
    assert p.ladder_rating == (1200, 20)
20
21
22
def test_faction():
23
    """
24
    Yes, this test was motivated by a bug
25
    :return:
26
    """
27
    p = Player('Schroedinger2')
28
    p.faction = 'aeon'
29
    assert p.faction == Faction.aeon
30
    p.faction = Faction.aeon
31
    assert p.faction == Faction.aeon
32
33
34
def test_equality_by_id():
35
    p = Player('Sheeo', 42)
36
    p2 = Player('RandomSheeo', 42)
37
    assert p == p2
38
    assert p.__hash__() == p2.__hash__()
39
40
41
def test_weak_references():
42
    p = Player(login='Test')
43
    weak_properties = ['lobby_connection', 'game_connection', 'game']
44
    referent = mock.Mock()
45
    for prop in weak_properties:
46
        setattr(p, prop, referent)
47
48
    del referent
49
    gc.collect()
50
51
    for prop in weak_properties:
52
        assert getattr(p, prop) is None
53
54
def test_unlink_weakref():
55
    p = Player(login='Test')
56
    mock_game = mock.Mock()
57
    p.game = mock_game
58
    assert p.game == mock_game
59
    del p.game
60
    assert p.game is None
61
62
def test_serialize():
63
    p = Player(id=42,
64
               login='Something',
65
               global_rating=(1234, 68),
66
               ladder_rating=(1500, 230),
67
               clan='TOAST',
68
               numGames=542)
69
    assert p.to_dict() == {
70
                    "id": 42,
71
                    "login": 'Something',
72
                    "global_rating": (1234, 68),
73
                    "ladder_rating": (1500, 230),
74
                    "number_of_games": 542,
75
                    "clan": 'TOAST'
76
    }
77