Exemple #1
0
    def test_correct_item(self):
        """ Check that stream returns correct item type """
        pdu = PDU()

        item = pdu._next_item(BytesIO(b'\x01'))
        self.assertTrue(isinstance(item, A_ASSOCIATE_RQ))

        item = pdu._next_item(BytesIO(b'\x02'))
        self.assertTrue(isinstance(item, A_ASSOCIATE_AC))

        item = pdu._next_item(BytesIO(b'\x10'))
        self.assertTrue(isinstance(item, ApplicationContextItem))
Exemple #2
0
    def test_empty_stream(self):
        """ Check that an empty stream returns None """
        s = BytesIO(b'')
        pdu = PDU()

        item = pdu._next_item(s)

        self.assertTrue(item is None)