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

bears.tests.go.GoVetBearTest.setUp()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 3
rs 10
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