Completed
Push — master ( 3c108b...266306 )
by Oleksandr
03:35
created

tests.test_lazy   A

Complexity

Total Complexity 37

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 37
eloc 68
dl 0
loc 91
rs 9.44
c 0
b 0
f 0

18 Methods

Rating   Name   Duplication   Size   Complexity  
A LazyStringTestCase.test_radd() 0 3 2
A LazyStringTestCase.test_contains() 0 3 2
A LazyStringTestCase.test_ne() 0 3 2
A LazyStringTestCase.test_str() 0 3 2
A LazyStringTestCase.test_mul() 0 3 2
A LazyStringTestCase.test_le() 0 5 2
A LazyStringTestCase.test_indexing() 0 3 2
A LazyStringTestCase.test_args_kwargs() 0 7 2
A LazyStringTestCase.test_eq() 0 3 2
A LazyStringTestCase.test_invalid_attribute() 0 5 3
A LazyStringTestCase.test_len() 0 3 2
A LazyStringTestCase.test_add() 0 3 2
A LazyStringTestCase.test_gt() 0 4 2
A LazyStringTestCase.test_iter() 0 3 2
A LazyStringTestCase.test_lt() 0 4 2
A LazyStringTestCase.test_format() 0 3 2
A LazyStringTestCase.test_rmul() 0 3 2
A LazyStringTestCase.test_ge() 0 5 2
1
import unittest
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
3
from verboselib.lazy import LazyString
4
5
6
class LazyStringTestCase(unittest.TestCase):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
7
8
  def test_str(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
9
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
10
    self.assertEqual(str(testee), "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
11
12
  def test_args_kwargs(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
13
    testee = LazyString(
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
14
      lambda a, b: "{} =? {} : {}".format(a, b, a == b),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
15
      10,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
16
      b=20
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
17
    )
18
    self.assertEqual(testee, "10 =? 20 : False")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
19
20
  def test_format(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
21
    testee = LazyString(lambda: "name: {name}")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
22
    self.assertEqual(testee.format(name="foo"), "name: foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
23
24
  def test_invalid_attribute(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
25
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
26
27
    with self.assertRaises(AttributeError):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
28
      testee.foo()
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 12 spaces were expected, but 6 were found.
Loading history...
29
30
  def test_len(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
31
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
32
    self.assertEqual(len(testee), 3)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
33
34
  def test_indexing(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
35
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
36
    self.assertEqual(testee[0], "f")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
37
38
  def test_iter(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
39
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
40
    self.assertEqual(list(iter(testee)), ["f", "o", "o"])
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
41
42
  def test_contains(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
43
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
44
    self.assertIn("f", testee)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
45
46
  def test_add(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
47
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
48
    self.assertEqual(testee + "bar", "foobar")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
49
50
  def test_radd(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
51
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
52
    self.assertEqual("bar" + testee, "barfoo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
53
54
  def test_mul(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
55
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
56
    self.assertEqual(testee * 3, "foofoofoo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
57
58
  def test_rmul(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
59
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
60
    self.assertEqual(3 * testee, "foofoofoo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
61
62
  def test_eq(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
63
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
64
    self.assertEqual(testee, "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
65
66
  def test_ne(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
67
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
68
    self.assertNotEqual(testee, "bar")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
69
70
  def test_lt(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
71
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
72
    self.assertFalse(testee < "boo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
73
    self.assertTrue( testee < "joo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
Coding Style introduced by
No space allowed after bracket
Loading history...
74
75
  def test_le(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
76
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
77
    self.assertFalse(testee <= "boo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
78
    self.assertTrue( testee <= "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
Coding Style introduced by
No space allowed after bracket
Loading history...
79
    self.assertTrue( testee <= "joo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
Coding Style introduced by
No space allowed after bracket
Loading history...
80
81
  def test_gt(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
82
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
83
    self.assertTrue( testee > "boo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
Coding Style introduced by
No space allowed after bracket
Loading history...
84
    self.assertFalse(testee > "joo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
85
86
  def test_ge(self):
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
introduced by
Missing function or method docstring
Loading history...
87
    testee = LazyString(lambda: "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
88
    self.assertTrue( testee >= "boo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
Coding Style introduced by
No space allowed after bracket
Loading history...
89
    self.assertTrue( testee >= "foo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
Coding Style introduced by
No space allowed after bracket
Loading history...
90
    self.assertFalse(testee >= "joo")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
91