Failed Conditions
Pull Request — master (#2076)
by Abdeali
02:11
created

UnresolvableBear2   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 5
Duplicated Lines 0 %
Metric Value
dl 0
loc 5
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A get_dependencies() 0 3 1
1
import unittest
2
3
from coalib.bears.Bear import Bear
4
from coalib.collecting import Dependencies
5
6
7
class BearWithoutDeps(Bear):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Bear does not seem to be defined.
Loading history...
8
9
    @staticmethod
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable staticmethod does not seem to be defined.
Loading history...
10
    def get_dependencies():
11
        return []
12
13
14
class ResolvableBear1(Bear):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Bear does not seem to be defined.
Loading history...
15
16
    @staticmethod
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable staticmethod does not seem to be defined.
Loading history...
17
    def get_dependencies():
18
        return [BearWithoutDeps]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable BearWithoutDeps does not seem to be defined.
Loading history...
19
20
21
class ResolvableBear2(Bear):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Bear does not seem to be defined.
Loading history...
22
23
    @staticmethod
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable staticmethod does not seem to be defined.
Loading history...
24
    def get_dependencies():
25
        return [ResolvableBear1, BearWithoutDeps]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable ResolvableBear1 does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable BearWithoutDeps does not seem to be defined.
Loading history...
26
27
28
class UnresolvableBear1(Bear):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Bear does not seem to be defined.
Loading history...
29
30
    @staticmethod
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable staticmethod does not seem to be defined.
Loading history...
31
    def get_dependencies():
32
        return [ResolvableBear1, BearWithoutDeps, UnresolvableBear3]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable UnresolvableBear3 does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable ResolvableBear1 does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable BearWithoutDeps does not seem to be defined.
Loading history...
33
34
35
class UnresolvableBear2(Bear):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Bear does not seem to be defined.
Loading history...
36
37
    @staticmethod
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable staticmethod does not seem to be defined.
Loading history...
38
    def get_dependencies():
39
        return [ResolvableBear1, BearWithoutDeps, UnresolvableBear1]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable UnresolvableBear1 does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable ResolvableBear1 does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable BearWithoutDeps does not seem to be defined.
Loading history...
40
41
42
class UnresolvableBear3(Bear):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Bear does not seem to be defined.
Loading history...
43
44
    @staticmethod
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable staticmethod does not seem to be defined.
Loading history...
45
    def get_dependencies():
46
        return [ResolvableBear1, BearWithoutDeps, UnresolvableBear2]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable BearWithoutDeps does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable UnresolvableBear2 does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable ResolvableBear1 does not seem to be defined.
Loading history...
47
48
49
class DependenciesTest(unittest.TestCase):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable unittest does not seem to be defined.
Loading history...
50
51
    def test_no_deps(self):
52
        self.assertEqual(
53
            len(Dependencies.resolve([BearWithoutDeps,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable BearWithoutDeps does not seem to be defined.
Loading history...
54
                                      BearWithoutDeps])),
55
            1)
56
57
    def test_resolvable_deps(self):
58
        self.assertEqual(Dependencies.resolve([ResolvableBear1,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable ResolvableBear1 does not seem to be defined.
Loading history...
59
                                               ResolvableBear2]),
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable ResolvableBear2 does not seem to be defined.
Loading history...
60
                         [BearWithoutDeps, ResolvableBear1, ResolvableBear2])
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable BearWithoutDeps does not seem to be defined.
Loading history...
61
62
    def test_unresolvable_deps(self):
63
        self.assertRaises(
64
            Dependencies.CircularDependencyError,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Dependencies does not seem to be defined.
Loading history...
65
            Dependencies.resolve,
66
            [UnresolvableBear1])
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable UnresolvableBear1 does not seem to be defined.
Loading history...
67