Exemplo n.º 1
0
 def test_string(self):
     for s in (ttypes.Status.VERIFY, ttypes.Status.DOWNLOAD,
               ttypes.Status.UPLOAD, ttypes.Status.INIT,
               ttypes.Status.CONNECTED, ttypes.Status.QUEUED,
               ttypes.Status.SEED, ttypes.Status.IDLE,
               ttypes.Status.STOPPED):
         self.assertEqual(ttypes.Status((s, )), (s, ))
Exemplo n.º 2
0
 def test_sort(self):
     statuses = [ttypes.Status.UPLOAD, ttypes.Status.CONNECTED,
                 ttypes.Status.SEED, ttypes.Status.INIT, ttypes.Status.VERIFY,
                 ttypes.Status.DOWNLOAD, ttypes.Status.STOPPED,
                 ttypes.Status.IDLE, ttypes.Status.QUEUED]
     sort = sorted([ttypes.Status((s,)) for s in statuses])
     exp = [(ttypes.Status.VERIFY,), (ttypes.Status.DOWNLOAD,),
            (ttypes.Status.UPLOAD,), (ttypes.Status.INIT,),
            (ttypes.Status.CONNECTED,), (ttypes.Status.QUEUED,),
            (ttypes.Status.IDLE,), (ttypes.Status.STOPPED,),
            (ttypes.Status.SEED,)]
     self.assertEqual(sort, exp)