# Path: groundstation/deferred.py
# class Deferred(object):
#     def __init__(self, at, thunk):
#         self.at = at
#         self.thunk = thunk
# 
#     def run(self):
#         self.thunk()
# 
# def defer_until(at):
#     def make_deferred(thunk):
#         return Deferred(at, thunk)
#     return make_deferred


import time
            import sys
from support.station_fixture import StationTestCase
from groundstation.deferred import Deferred, defer_until




class TestStationDeferreds(StationTestCase):
    def test_ready_deferred(self):
        now = time.time()
        deferred = Deferred(now - 10, None)
        self.station.register_deferred(deferred)
        self.assertEqual(len(self.station.deferreds), 1)
        self.assertTrue(self.station.has_ready_deferreds())

    def test_unready_deferred(self):
        now = time.time()

# Path: groundstation/deferred.py
# class Deferred(object):
#     def __init__(self, at, thunk):
#         self.at = at
#         self.thunk = thunk
# 
#     def run(self):
#         self.thunk()
# 
# def defer_until(at):
#     def make_deferred(thunk):
#         return Deferred(at, thunk)
#     return make_deferred


# Path: test/test_station_deferred.py
import time
            import sys
from support.station_fixture import StationTestCase
from groundstation.deferred import Deferred, defer_until





class TestStationDeferreds(StationTestCase):
    def test_ready_deferred(self):
        now = time.time()
        deferred = Deferred(now - 10, None)
        self.station.register_deferred(deferred)
        self.assertEqual(len(self.station.deferreds), 1)
        self.assertTrue(self.station.has_ready_deferreds())

    def test_unready_deferred(self):
        now = time.time()

        deferred = Deferred(now + 60, None)