def test_simple(self): from spectrumwars import Transceiver class Receiver(Transceiver): pass class Transmitter(Transceiver): pass sandbox = ThreadedSandbox([[Receiver, Transmitter]]) players = sandbox.get_players() self.assertEqual(len(players), 1) player = players[0] player.dst.init(1.) player.src.init(1.) player.dst.start(self.endpoint) player.src.start(self.endpoint) player.dst.join() player.src.join() self.assertEqual(self.server.stopped, 2) self.assertEqual(self.server.crashed, 0)
def test_empty(self): sandbox = ThreadedSandbox([]) players = sandbox.get_players() self.assertEqual(players, [])