コード例 #1
0
    def setUp(self):
        self.gossip_universe = GossipUniverse()

        # 14 23 34 13 24 33 => 6 minutes
        self.andy = bus_driver_from(Route([1, 2, 3]), self.gossip_universe)
        self.cindy = bus_driver_from(Route([4, 3]), self.gossip_universe)
        self.drivers = [self.andy, self.cindy]
コード例 #2
0
    def setUp(self):
        self.gossip_universe = GossipUniverse()

        # - minute    stop    G1    G2    G3
        #
        # -      1      3      y     y     n
        #               3      y     y     n
        #               4      n     n     y
        #
        # -      2      1      y     y     n
        #               2      y     y     y
        #               2      y     y     y
        #
        # -      3      2      y     y     n
        #               3      y     y     y
        #               3      y     y     y
        #
        # -      4      3      y     y     n
        #               1      y     y     y
        #               4      y     y     y
        #
        # -      5      3      y     y     y
        #               3      y     y     y
        #               5      y     y     y
        #
        # -             result => 5
        self.bob = bus_driver_from(Route([3, 1, 2, 3]), self.gossip_universe)
        self.alice = bus_driver_from(Route([3, 2, 3, 1]), self.gossip_universe)
        self.sascha = bus_driver_from(Route([4, 2, 3, 4, 5]),
                                      self.gossip_universe)
        self.drivers = [self.bob, self.alice, self.sascha]
    def test_driver_with_multiple_gossips_can_share_gossips_with_other_driver(
            self):
        bus_driver_with_multiple_gossips = bus_driver_from(
            Route([20, 54, 34]), self.gossip_universe)
        other_bus_driver = bus_driver_from(Route([20, 54, 34]),
                                           self.gossip_universe)

        second_gossip = Gossip(self.gossip_universe)
        bus_driver_with_multiple_gossips.got_to_know(second_gossip)

        bus_driver_with_multiple_gossips.share_gossips_with(other_bus_driver)

        self.assertEqual(
            other_bus_driver.known_gossips(), {
                other_bus_driver.gossip,
                bus_driver_with_multiple_gossips.gossip, second_gossip
            })
    def test_driver_can_share_gossips_with_other_driver(self):
        other_bus_driver = bus_driver_from(Route([20, 54, 34]),
                                           self.gossip_universe)

        self.bus_driver.share_gossips_with(other_bus_driver)

        self.assertEqual(other_bus_driver.known_gossips(),
                         {other_bus_driver.gossip, self.bus_driver.gossip})
 def setUp(self):
     self.gossip_universe = GossipUniverse()
     self.bus_driver = bus_driver_from(Route([20, 54, 34]),
                                       self.gossip_universe)
コード例 #6
0
 def setUp(self):
     self.gossip_universe = GossipUniverse()
     self.boris = bus_driver_from(Route([1, 12, 13]), self.gossip_universe)
     self.anna = bus_driver_from(Route([1, 22, 23]), self.gossip_universe)
     self.sam = bus_driver_from(Route([12, 32, 33]), self.gossip_universe)
コード例 #7
0
    def setUp(self):
        self.gossip_universe = GossipUniverse()

        self.martin = bus_driver_from(Route([2, 1, 2]), self.gossip_universe)
        self.alex = bus_driver_from(Route([5, 2, 8]), self.gossip_universe)
        self.drivers = [self.martin, self.alex]