def test_small_fragments(self): pktlines = [] parser = PktLineParser(pktlines.append) parser.parse(b"00") parser.parse(b"05") parser.parse(b"z0000") self.assertEqual(pktlines, [b"z", None]) self.assertEqual(b"", parser.get_tail())
def test_small_fragments(self): pktlines = [] parser = PktLineParser(pktlines.append) parser.parse("00") parser.parse("05") parser.parse("z0000") self.assertEquals(pktlines, ["z", None]) self.assertEquals("", parser.get_tail())
def test_multiple_packets(self): pktlines = [] parser = PktLineParser(pktlines.append) parser.parse(b"0005z0006aba") self.assertEqual(pktlines, [b"z", b"ab"]) self.assertEqual(b"a", parser.get_tail())
def test_none(self): pktlines = [] parser = PktLineParser(pktlines.append) parser.parse(b"0000") self.assertEqual(pktlines, [None]) self.assertEqual(b"", parser.get_tail())
def test_multiple_packets(self): pktlines = [] parser = PktLineParser(pktlines.append) parser.parse("0005z0006aba") self.assertEquals(pktlines, ["z", "ab"]) self.assertEquals("a", parser.get_tail())
def test_none(self): pktlines = [] parser = PktLineParser(pktlines.append) parser.parse("0000") self.assertEquals(pktlines, [None]) self.assertEquals("", parser.get_tail())