[testlib] missing method on value generator to generate the Interval type
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 24 Jan 2011 19:09:42 +0100
changeset 6884 6fa712e9dfa5
parent 6883 1538542a88ed
child 6931 0af44a38fe41
[testlib] missing method on value generator to generate the Interval type
devtools/fill.py
--- a/devtools/fill.py	Mon Jan 24 19:09:14 2011 +0100
+++ b/devtools/fill.py	Mon Jan 24 19:09:42 2011 +0100
@@ -157,6 +157,11 @@
         base = date(randint(2000, 2010), 1, 1) + timedelta(randint(1, 365))
         return self._constrained_generate(entity, attrname, base, timedelta(days=1), index)
 
+    def generate_interval(self, entity, attrname, index):
+        """generates a random date (format is 'yyyy-mm-dd')"""
+        base = timedelta(randint(1, 365))
+        return self._constrained_generate(entity, attrname, base, timedelta(days=1), index)
+
     def generate_time(self, entity, attrname, index):
         """generates a random time (format is ' HH:MM')"""
         return time(11, index%60) #'11:%02d' % (index % 60)