import md5
import string
-def current(obj, sig):
- """Return whether a given object is up-to-date with the
- specified signature.
+def current(new, old):
+ """Return whether a new signature is up-to-date with
+ respect to an old signature.
"""
- return obj.get_signature() == sig
+ return new == old
def hexdigest(s):
"""Return a signature as a string of hex characters.
Simple comparison of different "signature" values.
"""
obj = my_obj('111')
- assert not current(obj, signature(my_obj('110')))
- assert current(obj, signature(my_obj('111')))
- assert not current(obj, signature(my_obj('112')))
+ assert not current(obj.get_signature(), signature(my_obj('110')))
+ assert current(obj.get_signature(), signature(my_obj('111')))
+ assert not current(obj.get_signature(), signature(my_obj('112')))
def test_collect(self):
"""Test collecting a list of signatures into a new signature value
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-def current(obj, sig):
- """Return whether the objects timestamp is up-to-date.
+def current(new, old):
+ """Return whether a new timestamp is up-to-date with
+ respect to an old timestamp.
"""
- return obj.get_signature() >= sig
+ return not old is None and new <= old
def collect(signatures):
"""
Simple comparison of different timestamp values.
"""
o1 = my_obj(value = 111)
- assert current(o1, 110)
- assert current(o1, 111)
- assert not current(o1, 112)
+ assert not current(o1.get_signature(), 110)
+ assert current(o1.get_signature(), 111)
+ assert current(o1.get_signature(), 112)
def test_collect(self):
"""Test collecting a list of signatures into a new signature value
else:
newsig = self.signature(node)
- return newsig == oldsig
+ return self.module.current(newsig, oldsig)
def write(self, nodes):
"""