File: test_borg.py

package info (click to toggle)
terminator 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,916 kB
  • sloc: python: 11,390; sh: 26; makefile: 15
file content (56 lines) | stat: -rwxr-xr-x 1,057 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
# Terminator by Chris Jones <cmsj@tenshu.net>
# GPL v2 only
"""test_borg.py - We are the borg. Resistance is futile.
   doctests for borg.py

>>> obj1 = TestBorg()
>>> obj2 = TestBorg()
>>> obj1.attribute
0
>>> obj2.attribute
0
>>> obj1.attribute = 12345
>>> obj1.attribute
12345
>>> obj2.attribute
12345
>>> obj2.attribute = 54321
>>> obj1.attribute
54321
>>> obj3 = TestBorg2()
>>> obj3.attribute
1
>>> obj4 = TestBorg2()
>>> obj3.attribute = 98765
>>> obj4.attribute
98765
>>>

"""

from terminatorlib.borg import Borg


class TestBorg(Borg):
    attribute = None

    def __init__(self):
        Borg.__init__(self, self.__class__.__name__)
        self.prepare_attributes()
    
    def prepare_attributes(self):
        if not self.attribute:
            self.attribute = 0


class TestBorg2(Borg):
    attribute = None

    def __init__(self):
        Borg.__init__(self, self.__class__.__name__)
        self.prepare_attributes()

    def prepare_attributes(self):
        if not self.attribute:
            self.attribute = 1