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

TextPositionTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %
Metric Value
dl 0
loc 27
rs 10
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_properties() 0 12 1
B test_fail_instantation() 0 12 5
1
import unittest
2
3
from coalib.results.TextPosition import TextPosition
4
5
6
class TextPositionTest(unittest.TestCase):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable unittest does not seem to be defined.
Loading history...
7
8
    def test_fail_instantation(self):
9
        with self.assertRaises(ValueError):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable ValueError does not seem to be defined.
Loading history...
10
            TextPosition(None, 2)
11
12
        with self.assertRaises(TypeError):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable TypeError does not seem to be defined.
Loading history...
13
            TextPosition("hello", 3)
14
15
        with self.assertRaises(TypeError):
16
            TextPosition(4, "world")
17
18
        with self.assertRaises(TypeError):
19
            TextPosition("double", "string")
20
21
    def test_properties(self):
22
        uut = TextPosition(None, None)
23
        self.assertEqual(uut.line, None)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable uut does not seem to be defined.
Loading history...
24
        self.assertEqual(uut.column, None)
25
26
        uut = TextPosition(7, None)
27
        self.assertEqual(uut.line, 7)
28
        self.assertEqual(uut.column, None)
29
30
        uut = TextPosition(8, 39)
31
        self.assertEqual(uut.line, 8)
32
        self.assertEqual(uut.column, 39)
33