[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/develop] Add a doctest for bridgedb.schedule.Unscheduled.



commit 35715f1c09a4d8bce57217835d13080a0323174a
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Tue Mar 31 10:13:30 2015 +0000

    Add a doctest for bridgedb.schedule.Unscheduled.
---
 lib/bridgedb/schedule.py |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/lib/bridgedb/schedule.py b/lib/bridgedb/schedule.py
index 06914d9..4d0b8fd 100644
--- a/lib/bridgedb/schedule.py
+++ b/lib/bridgedb/schedule.py
@@ -64,8 +64,28 @@ class ISchedule(interface.Interface):
 
 
 class Unscheduled(object):
-    """A base ``Schedule`` that has only one period that contains all time."""
+    """A base ``Schedule`` that has only one period that contains all time.
+
+    >>> from bridgedb.schedule import fromUnixSeconds
+    >>> from bridgedb.schedule import Unscheduled
+    >>> timestamp = 1427769526
+    >>> str(fromUnixSeconds(timestamp))
+    '2015-03-31 02:38:46'
+    >>> sched = Unscheduled()
+    >>> start = sched.intervalStart(timestamp)
+    >>> start
+    -62135596800
+    >>> str(fromUnixSeconds(start))
+    '0001-01-01 00:00:00'
+    >>> sched.getInterval(timestamp)
+    '1970-01-01 00:00:00'
+    >>> next = sched.nextIntervalStarts(timestamp)
+    >>> next
+    253402300799
+    >>> str(fromUnixSeconds(next))
+    '9999-12-31 23:59:59'
 
+    """
     implements(ISchedule)
 
     def __init__(self, count=None, period=None):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits