def setUp(self): # Create an test packet with AFC = 3 and AF_LENGTH = 4 tsp_bytes = bytes.fromhex("47000130"+"04"+183*"00") self.tsp = TSPacket(tsp_bytes)
def test_ctor_2(self): """Test the constructor of TSPacket when a wrong type is passed.""" tsp_bytes = bytearray.fromhex("47000100"+184*"00") tsp = TSPacket(tsp_bytes)
def test_ctor_3(self): """Test the constructor of TSPacket if insufficient number of bytes are passed.""" tspkt_bytes = bytes.fromhex("470001") with self.assertRaises(TSPacketError) as cm: tspkt = TSPacket(tspkt_bytes)
def test_ctor(self): """Test the constructor of TSPacket for correct behavior.""" tspkt_bytes = bytes.fromhex("47000100"+184*"00") tspkt = TSPacket(tspkt_bytes)