terminator/tests/test_borg.py

57 lines
1.0 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/env python
# Terminator by Chris Jones <cmsj@tenshu.net>
# GPL v2 only
2020-05-01 14:36:16 +00:00
"""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
2020-05-01 14:36:16 +00:00
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
2020-05-01 14:36:16 +00:00
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