Skip to content

Commit 327e51c

Browse files
committed
Removed redundant parentheses.
1 parent 3af7db7 commit 327e51c

File tree

1 file changed

+83
-83
lines changed

1 file changed

+83
-83
lines changed

mediator.py

Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,117 @@
11
"""http://dpip.testingperspective.com/?p=28"""
22

3-
import time
3+
import time
44

55

66
class TC:
7-
def __init__(self):
8-
self._tm = tm
9-
self._bProblem = 0
10-
11-
def setup(self):
12-
print("Setting up the Test")
13-
time.sleep(1)
14-
self._tm.prepareReporting()
15-
16-
def execute(self):
17-
if not self._bProblem:
18-
print("Executing the test")
19-
time.sleep(1)
20-
else:
21-
print("Problem in setup. Test not executed.")
22-
23-
def tearDown(self):
24-
if not self._bProblem:
25-
print("Tearing down")
26-
time.sleep(1)
27-
self._tm.publishReport()
28-
else:
29-
print("Test not executed. No tear down required.")
7+
def __init__(self):
8+
self._tm = tm
9+
self._bProblem = 0
10+
11+
def setup(self):
12+
print("Setting up the Test")
13+
time.sleep(1)
14+
self._tm.prepareReporting()
15+
16+
def execute(self):
17+
if not self._bProblem:
18+
print("Executing the test")
19+
time.sleep(1)
20+
else:
21+
print("Problem in setup. Test not executed.")
22+
23+
def tearDown(self):
24+
if not self._bProblem:
25+
print("Tearing down")
26+
time.sleep(1)
27+
self._tm.publishReport()
28+
else:
29+
print("Test not executed. No tear down required.")
3030

3131
def setTM(self, TM):
32-
self._tm = tm
32+
self._tm = tm
3333

34-
def setProblem(self, value):
35-
self._bProblem = value
34+
def setProblem(self, value):
35+
self._bProblem = value
3636

3737

3838
class Reporter:
39-
def __init__(self):
40-
self._tm = None
39+
def __init__(self):
40+
self._tm = None
4141

42-
def prepare(self):
43-
print("Reporter Class is preparing to report the results")
44-
time.sleep(1)
42+
def prepare(self):
43+
print("Reporter Class is preparing to report the results")
44+
time.sleep(1)
4545

46-
def report(self):
47-
print("Reporting the results of Test")
48-
time.sleep(1)
46+
def report(self):
47+
print("Reporting the results of Test")
48+
time.sleep(1)
4949

5050
def setTM(self, TM):
51-
self._tm = tm
51+
self._tm = tm
5252

5353

5454
class DB:
55-
def __init__(self):
56-
self._tm = None
57-
58-
def insert(self):
59-
print("Inserting the execution begin status in the Database")
60-
time.sleep(1)
61-
#Following code is to simulate a communication from DB to TC
62-
import random
55+
def __init__(self):
56+
self._tm = None
57+
58+
def insert(self):
59+
print("Inserting the execution begin status in the Database")
60+
time.sleep(1)
61+
#Following code is to simulate a communication from DB to TC
62+
import random
6363
if random.randrange(1, 4) == 3:
64-
return -1
64+
return -1
6565

66-
def update(self):
67-
print("Updating the test results in Database")
68-
time.sleep(1)
66+
def update(self):
67+
print("Updating the test results in Database")
68+
time.sleep(1)
6969

7070
def setTM(self, TM):
71-
self._tm = tm
71+
self._tm = tm
7272

7373

7474
class TestManager:
75-
def __init__(self):
76-
self._reporter = None
77-
self._db = None
78-
self._tc = None
75+
def __init__(self):
76+
self._reporter = None
77+
self._db = None
78+
self._tc = None
7979

80-
def prepareReporting(self):
81-
rvalue = self._db.insert()
82-
if rvalue == -1:
83-
self._tc.setProblem(1)
84-
self._reporter.prepare()
80+
def prepareReporting(self):
81+
rvalue = self._db.insert()
82+
if rvalue == -1:
83+
self._tc.setProblem(1)
84+
self._reporter.prepare()
8585

86-
def setReporter(self, reporter):
87-
self._reporter = reporter
86+
def setReporter(self, reporter):
87+
self._reporter = reporter
8888

89-
def setDB(self, db):
90-
self._db = db
89+
def setDB(self, db):
90+
self._db = db
9191

92-
def publishReport(self):
93-
self._db.update()
94-
rvalue = self._reporter.report()
92+
def publishReport(self):
93+
self._db.update()
94+
rvalue = self._reporter.report()
9595

9696
def setTC(self, tc):
97-
self._tc = tc
98-
99-
100-
if __name__ == '__main__':
101-
reporter = Reporter()
102-
db = DB()
103-
tm = TestManager()
104-
tm.setReporter(reporter)
105-
tm.setDB(db)
106-
reporter.setTM(tm)
107-
db.setTM(tm)
108-
# For simplification we are looping on the same test.
97+
self._tc = tc
98+
99+
100+
if __name__ == '__main__':
101+
reporter = Reporter()
102+
db = DB()
103+
tm = TestManager()
104+
tm.setReporter(reporter)
105+
tm.setDB(db)
106+
reporter.setTM(tm)
107+
db.setTM(tm)
108+
# For simplification we are looping on the same test.
109109
# Practically, it could be about various unique test classes and their
110110
# objects
111-
while (True):
112-
tc = TC()
113-
tc.setTM(tm)
114-
tm.setTC(tc)
115-
tc.setup()
116-
tc.execute()
111+
while True:
112+
tc = TC()
113+
tc.setTM(tm)
114+
tm.setTC(tc)
115+
tc.setup()
116+
tc.execute()
117117
tc.tearDown()

0 commit comments

Comments
 (0)