Failed Conditions
Pull Request — master (#1266)
by Udayan
01:47
created

bears.tests.go.GoVetBearTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %
Metric Value
dl 0
loc 19
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_run() 0 12 1
A setUp() 0 3 1
1
import sys
2
from queue import Queue
3
from shutil import which
4
from unittest.case import skipIf
5
6
sys.path.insert(0, ".")
7
import unittest
8
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
9
from bears.go.GofmtBear import GofmtBear
10
from coalib.settings.Section import Section
11
12
13
@skipIf(which('gofmt') is None, 'gofmt is not installed')
14
class GoVetBearTest(LocalBearTestHelper):
15
16
    def setUp(self):
17
        self.section = Section("test section")
18
        self.uut = GofmtBear(self.section, Queue())
19
20
    def test_run(self):
21
        self.assertLinesInvalid(self.uut,
22
                                ['package main',
23
                                 'func main() {',
24
                                 '    return 1',
25
                                 '}'])
26
        self.assertLinesValid(self.uut,
27
                              ['package main',
28
                               '',
29
                               'func main() {',
30
                               '\treturn 1',
31
                               '}'])
32
33
34
if __name__ == '__main__':
35
    unittest.main(verbosity=2)
36