File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ from borg import Borg , YourBorg
2+ import sys
3+
4+ if sys .version_info < (2 , 7 ):
5+ import unittest2 as unittest
6+ else :
7+ import unittest
8+
9+ class BorgTest (unittest .TestCase ):
10+
11+ @classmethod
12+ def setUpClass (self ):
13+ self .b1 = Borg ()
14+ self .b2 = Borg ()
15+ self .ib1 = YourBorg ()
16+
17+ def test_initial_borg_state_shall_be_init (self ):
18+ b = Borg ()
19+ self .assertEqual (b .state , 'Init' )
20+
21+ def test_changing_instance_attribute_shall_change_borg_state (self ):
22+ self .b1 .state = 'Running'
23+ self .assertEqual (self .b1 .state , 'Running' )
24+ self .assertEqual (self .b2 .state , 'Running' )
25+ self .assertEqual (self .ib1 .state , 'Running' )
26+
27+ def test_instances_shall_have_own_ids (self ):
28+ self .assertNotEqual (id (self .b1 ), id (self .b2 ), id (self .ib1 ))
29+
30+ if __name__ == "__main__" :
31+ unittest .main ()
You can’t perform that action at this time.
0 commit comments