def test_assignment_and_exceptions(self):
        """ Check incorrect types/values for properties raise exceptions """
        primitive = AsynchronousOperationsWindowNegotiation()

        ## Check default assignment
        self.assertTrue(primitive.maximum_number_operations_invoked == 1)
        self.assertTrue(primitive.maximum_number_operations_performed == 1)

        ## Check assignment
        primitive.maximum_number_operations_invoked = 10
        self.assertTrue(primitive.maximum_number_operations_invoked == 10)

        primitive.maximum_number_operations_performed = 11
        self.assertTrue(primitive.maximum_number_operations_performed == 11)

        ## Check exceptions
        with pytest.raises(TypeError):
            primitive.maximum_number_operations_invoked = 45.2

        with pytest.raises(ValueError):
            primitive.maximum_number_operations_invoked = -1

        with pytest.raises(TypeError):
            primitive.maximum_number_operations_invoked = 'ABCD1234ABCD12345'

        with pytest.raises(TypeError):
            primitive.maximum_number_operations_performed = 45.2

        with pytest.raises(ValueError):
            primitive.maximum_number_operations_performed = -1

        with pytest.raises(TypeError):
            primitive.maximum_number_operations_performed = 'ABCD1234ABCD12345'
    def test_conversion(self):
        """ Check converting to PDU item works correctly """
        primitive = AsynchronousOperationsWindowNegotiation()
        primitive.maximum_number_operations_invoked = 10
        primitive.maximum_number_operations_performed = 0
        item = primitive.from_primitive()

        self.assertTrue(item.encode() == b'\x53\x00\x00\x04\x00\x0a\x00\x00')
 def test_string(self):
     """Check the string output."""
     primitive = AsynchronousOperationsWindowNegotiation()
     primitive.maximum_number_operations_invoked = 10
     primitive.maximum_number_operations_performed = 0
     self.assertTrue('invoked: 10' in primitive.__str__())
     self.assertTrue('performed: 0' in primitive.__str__())