def test_from_pkt(self): pkt = ts.pad('5') + ts.pad('UV') + ts.pad('4') + ts.pad('still') + ts.pad('1') task, obs, still, args = ts.from_pkt(pkt) self.assertEqual(task, 'UV') self.assertEqual(obs, 4) self.assertEqual(still, 'still') self.assertEqual(args, ['1'])
def test_to_pkt(self): pkt = ts.to_pkt('UV', 5, 'still', ['1','2','3']) self.assertEqual(len(pkt), 7*ts.PKT_LINE_LEN) self.assertEqual(pkt[:ts.PKT_LINE_LEN], ts.pad('7'))
def test_pad(self): self.assertEqual(len(ts.pad('', 80)), 80) self.assertEqual(len(ts.pad('abc'*10, 30)), 30)