License.
"""
from npdu import NPDU
from _exceptions import BACnetError

##
# Test cases to exercise the data encoders and decoders.
#

from mpx_test import DefaultTestFixture, main


class TestCase(DefaultTestFixture):
    def test_write_property_multiple_error(self):
        npdu_msg = ('\x01\x00P\xee\x10\x0e\x91\x02\x91*\x0f'
                    '\x1e\x0c \xc0\x00\t\x19{)\x01\x1f')
        npdu = NPDU()
        npdu.fromstring(npdu_msg)
        exc_msg = str(BACnetError(npdu))
        self.assert_comparison("exc_msg.find('(writePropertyMultiple)')", ">",
                               "-1")
        return

    def test_no_npdu(self):
        exc_msg = str(BACnetError(None))
        return


if __name__ == '__main__':
    main()
        props.set('NewAttribute', 'Value')
        v = props.NewAttribute
        assert v == 'Value', 'Attribute not created'
        return

    def test_default_properites(self):
        props = Properties(self.file_object)
        v = props.get('ROOT')
        assert v != None, 'ROOT is undefined'
        return

    def test_default_properites_2(self):
        props = Properties(self.file_object)
        v = props.ROOT
        assert v != None, 'ROOT is undefined'
        return

    def test_str(self):
        v = str(Properties(self.file_object))
        assert v != None, 'Error while dumping properites'
        return

    def test_repr(self):
        v = repr(Properties(self.file_object))
        assert v != None, 'Error while dumping properites'
        return


if __name__ == '__main__':
    main(TestCase)
        self.formatter.add_text('title text')
        self.formatter.close_tag()
        self.formatter.open_tag('body')
        self.formatter.add_text('body text')
        self.formatter.single_tag('br')
        self.formatter.open_close_tag('img', src='image_source', x='image_x', y='image_y')
        self.formatter.close_tag('body')
        output = self.formatter.output_complete()
        self.failUnless(output == _html,
                        'output = %r\n\nhtml = %r' % (output, _html))
    def test_partial_output(self):
        self.formatter.open_tag('html')
        self.formatter.open_tag('title')
        self.formatter.add_text('title text')
        self.formatter.close_tag()
        output = self.formatter.output()
        self.failUnless(output == _html[0:35], 'output = %r\n\nhtml = %r' % (output, _html[0:35]))
        self.formatter.open_tag('body')
        output = self.formatter.output()
        self.failUnless(output == _html[35:43], 'output = %r\n\nhtml = %r' % (output, _html[35:43]))
        self.formatter.add_text('body text')
        self.formatter.single_tag('br')
        self.formatter.open_close_tag('img', src='image_source', x='image_x', y='image_y')
        self.formatter.close_tag('body')
        self.formatter.close_tag()
        output = self.formatter.output()
        self.failUnless(output == _html[43:], 'output = %r\n\nhtml = %r' % (output, _html[43:]))

if __name__ == '__main__':
    main()
        v = props.get('Attribute')
        assert v == 'Value', 'Attribute not created'
        return
    def test_set_property_2(self):
        props = Properties(self.file_object)
        props.set('NewAttribute', 'Value')
        v = props.NewAttribute
        assert v == 'Value', 'Attribute not created'
        return
    def test_default_properites(self):
        props = Properties(self.file_object)
        v = props.get('ROOT')
        assert v != None, 'ROOT is undefined'
        return
    def test_default_properites_2(self):
        props = Properties(self.file_object)
        v = props.ROOT
        assert v != None, 'ROOT is undefined'
        return
    def test_str(self):
        v = str(Properties(self.file_object))
        assert v != None, 'Error while dumping properites'
        return
    def test_repr(self):
        v = repr(Properties(self.file_object))
        assert v != None, 'Error while dumping properites'
        return

if __name__ == '__main__':
    main(TestCase)