def test_parse_metrics_latency(self): message = "nothing Latency: 89.359874523 nothing nothing" latency, jitter, bandwidth, packetloss = parse_metrics(message) self.assertEqual(latency, 89.359874523) self.assertTrue(math.isnan(jitter)) self.assertTrue(math.isnan(bandwidth)) self.assertTrue(math.isnan(packetloss))
def test_parse_metrics_no_one(self): message = "nothing nothing nothing nothing nothing nothing nothing nothing" latency, jitter, bandwidth, packetloss = parse_metrics(message) self.assertTrue(math.isnan(latency)) self.assertTrue(math.isnan(jitter)) self.assertTrue(math.isnan(bandwidth)) self.assertTrue(math.isnan(packetloss))
def test_parse_metrics_wrong(self): message = "nothing Jitter: nothing PacketLoss: nothing Latency: nothing BandWidth: nothing nothing" latency, jitter, bandwidth, packetloss = parse_metrics(message) self.assertTrue(math.isnan(latency)) self.assertTrue(math.isnan(jitter)) self.assertTrue(math.isnan(bandwidth)) self.assertTrue(math.isnan(packetloss))
def test_parse_metrics_couple(self): message = "nothing PacketLoss: 89.359874523 nothing nothing Jitter: 24.011993 nothing nothing" latency, jitter, bandwidth, packetloss = parse_metrics(message) self.assertTrue(math.isnan(latency)) self.assertEqual(jitter, 24.011993) self.assertTrue(math.isnan(bandwidth)) self.assertEqual(packetloss, 89.359874523)