I have class hierarchy as follows:
class ContextSummary(object):
def __init__(self, id, db):
self.db = db
self.id = id
class GroupContextSummary(ContextSummary):
def __init__(self, gId, db = {}):
super(GroupContextSummary, self).__init__(gId, db)
I use GroupContextSummary
class without the 2nd parameter multiple times in unittest.
groupSummary = GroupContextSummary(gId)
The issue is that the db still keeps the previous run values. In order to prevent this, I had to use
groupSummary = GroupContextSummary(gId, {})
Or I had to redefine the init method as
def __init__(self, gId, db = None):
if db is None: db = {}
super(GroupContextSummary, self).__init__(gId, db)
What might be wrong?