From 43f1c72511e3f68172ea16f742506693b8feff4c Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 1 Aug 2011 11:17:01 +1200 Subject: Refactor the way we calculate views of the flow list. The naive approach we used before recalculated the view on every access, and consequently had serious performance problems. --- test/test_console.py | 2 +- test/test_flow.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test_console.py b/test/test_console.py index 6040763a..f0c939ed 100644 --- a/test/test_console.py +++ b/test/test_console.py @@ -12,7 +12,7 @@ class uState(libpry.AutoTree): """ c = console.ConsoleState() f = self._add_request(c) - assert f.request in c.flow_map + assert f.request in c._flow_map assert c.get_focus() == (f, 0) def test_focus(self): diff --git a/test/test_flow.py b/test/test_flow.py index ba276248..ec62f4c8 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -152,7 +152,7 @@ class uFlow(libpry.AutoTree): f.response = tutils.tresp() f.request = f.response.request assert not f.match(filt.parse("~b test")) - assert not f.match(None) + assert f.match(None) def test_backup(self): f = tutils.tflow() @@ -260,23 +260,23 @@ class uState(libpry.AutoTree): f = c.add_request(req) assert f assert c.flow_count() == 1 - assert c.flow_map.get(req) + assert c._flow_map.get(req) assert c.active_flow_count() == 1 newreq = tutils.treq() assert c.add_request(newreq) - assert c.flow_map.get(newreq) + assert c._flow_map.get(newreq) assert c.active_flow_count() == 2 resp = tutils.tresp(req) assert c.add_response(resp) assert c.flow_count() == 2 - assert c.flow_map.get(resp.request) + assert c._flow_map.get(resp.request) assert c.active_flow_count() == 1 unseen_resp = tutils.tresp() assert not c.add_response(unseen_resp) - assert not c.flow_map.get(unseen_resp.request) + assert not c._flow_map.get(unseen_resp.request) assert c.active_flow_count() == 1 resp = tutils.tresp(newreq) @@ -373,7 +373,7 @@ class uState(libpry.AutoTree): c.clear() c.load_flows(flows) - assert isinstance(c.flow_list[0], flow.Flow) + assert isinstance(c._flow_list[0], flow.Flow) def test_accept_all(self): c = flow.State() @@ -418,7 +418,7 @@ class uSerialize(libpry.AutoTree): s = flow.State() fm = flow.FlowMaster(None, s) fm.load_flows(r) - assert len(s.flow_list) == 6 + assert len(s._flow_list) == 6 def test_error(self): -- cgit v1.2.3