From 7a205e80aa94600291f87c96e51f13abe9fb4703 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 9 Feb 2017 14:21:25 +0100 Subject: [PATCH] improve stateobject tests --- test/mitmproxy/test_stateobject.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/mitmproxy/test_stateobject.py b/test/mitmproxy/test_stateobject.py index b9ffe7ae6..edec92c20 100644 --- a/test/mitmproxy/test_stateobject.py +++ b/test/mitmproxy/test_stateobject.py @@ -17,6 +17,9 @@ class Child(StateObject): obj.set_state(state) return obj + def __eq__(self, other): + return isinstance(other, Child) and self.x == other.x + class Container(StateObject): def __init__(self): @@ -60,4 +63,7 @@ def test_container_list(): "child": None, "children": [{"x": 42}, {"x": 44}] } - assert len(a.copy().children) == 2 + copy = a.copy() + assert len(copy.children) == 2 + assert copy.children is not a.children + assert copy.children[0] is not a.children[0]