Hi!
The `validate()` method checks if address is different from address + count.
I think this should be simplified to check if count == 0.
The patch below should do this. Please have a look and incorporate the patch
if you agree.
Best regards,
Albert
Index: store.py
===================================================================
--- store.py (Revision 117)
+++ store.py (Arbeitskopie)
@@ -200,11 +200,10 @@
:param count: The number of values to test for
:returns: True if the request in within range, False otherwise
'''
- result = False
- if not address == address + count:
- handle = set(range(address, address + count))
- result = handle.issubset(set(self.values.iterkeys()))
- return result
+ if count == 0:
+ return False
+ handle = set(range(address, address + count))
+ return handle.issubset(set(self.values.iterkeys()))
def getValues(self, address, count=1):
''' Returns the requested values of the datastore
Index: test/test_datastore.py
===================================================================
--- test/test_datastore.py (Revision 117)
+++ test/test_datastore.py (Arbeitskopie)
@@ -71,6 +71,8 @@
self.assertFalse(block.validate(0, 20))
self.assertFalse(block.validate(10, 1))
self.assertTrue(block.validate(0x00, 10))
+ self.assertFalse(block.validate(0, 0))
+ self.assertFalse(block.validate(5, 0))
block.setValues(0x00, True)
self.assertEqual(block.getValues(0x00, 1), [True])
Original issue reported on code.google.com by albert.k...@gmail.com on 22 Feb 2011 at 1:38
Original issue reported on code.google.com by
albert.k...@gmail.com
on 22 Feb 2011 at 1:38