From c8316a35a1eb292f09db8b7ff36dd33b43dfe8b6 Mon Sep 17 00:00:00 2001 From: rcoh Date: Sat, 12 Feb 2011 20:39:58 -0500 Subject: Added an override of setLastOutput to square.py. Added some pre-built queries into the BQS. Modified the default behavior or setLastOutput to make a deep copy of ouput to prevent accidental interference. --- tests/TestBQS.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/TestBQS.py b/tests/TestBQS.py index 7316c31..c46b917 100644 --- a/tests/TestBQS.py +++ b/tests/TestBQS.py @@ -13,13 +13,16 @@ class TestBQS(unittest.TestCase): c.addInput({'Location':(5,12)}) b.timeStep() c.timeStep() + def tearDown(self): bqs.initBQS() + def test_simple_query(self): validQuery = lambda args:args['Color']==(255,0,0) invalidQuery = lambda args:args['Color']==(254,0,0) assert bqs.query(validQuery) == [{'Color':(255,0,0), 'Location':(3,4)}] assert bqs.query(invalidQuery) == [] + def test_dist_query(self): validDist = lambda args:geo.dist(args['Location'], (0,0)) <= 5 invalidDist = lambda args:geo.dist(args['Location'], (0,0)) <= 2 @@ -30,7 +33,6 @@ class TestBQS(unittest.TestCase): assert bqs.query(doubleDist) == [{'Color':(255,0,0), 'Location':(3,4)}, {'Color':(0,0,255),\ 'Location':(5,12)}] def test_complex_queries(self): - validQuery = lambda args:args['Color']==(255,0,0) doubleDist = lambda args:geo.dist(args['Location'], (0,0)) <= 20 -- cgit v1.2.3