aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/stateobject.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-02-07 02:36:39 +0100
committerMaximilian Hils <git@maximilianhils.com>2014-02-07 02:36:39 +0100
commit9f5f2b707165d14cbf0ace9a55ec2d1dc44d9802 (patch)
treefaaabe2a4ec11607076217bacca1b9d8ae866b23 /libmproxy/stateobject.py
parent66090f9aea01094a42c53c762ae5852b7ee91e86 (diff)
downloadmitmproxy-9f5f2b707165d14cbf0ace9a55ec2d1dc44d9802.tar.gz
mitmproxy-9f5f2b707165d14cbf0ace9a55ec2d1dc44d9802.tar.bz2
mitmproxy-9f5f2b707165d14cbf0ace9a55ec2d1dc44d9802.zip
test libmproxy.app, increase coverage
Diffstat (limited to 'libmproxy/stateobject.py')
-rw-r--r--libmproxy/stateobject.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/libmproxy/stateobject.py b/libmproxy/stateobject.py
index 2cbec068..7d91519d 100644
--- a/libmproxy/stateobject.py
+++ b/libmproxy/stateobject.py
@@ -1,13 +1,17 @@
class StateObject(object):
- def _get_state(self):
+ def _get_state(self): # pragma: nocover
raise NotImplementedError
- def _load_state(self, state):
+ def _load_state(self, state): # pragma: nocover
raise NotImplementedError
@classmethod
- def _from_state(cls, state):
+ def _from_state(cls, state): # pragma: nocover
raise NotImplementedError
+ # Usually, this function roughly equals to the following code:
+ # f = cls()
+ # f._load_state(state)
+ # return f
def __eq__(self, other):
try:
@@ -66,10 +70,4 @@ class SimpleStateObject(StateObject):
elif hasattr(cls, "_from_state"):
setattr(self, attr, cls._from_state(state[attr]))
else:
- setattr(self, attr, cls(state[attr]))
-
- @classmethod
- def _from_state(cls, state):
- f = cls() # the default implementation assumes an empty constructor. Override accordingly.
- f._load_state(state)
- return f \ No newline at end of file
+ setattr(self, attr, cls(state[attr])) \ No newline at end of file