@@ -0,0 +1,1648 @@
+%0Aimport unittest%0Aimport os%0Aimport glob%0Aimport libtaxii.messages_11 as tm11%0Aimport libtaxii.taxii_default_query as tdq%0A# from libtaxii.validation import SchemaValidator%0A%0Aclass  To_text_11_test(unittest.TestCase):%0A    input_path = os.path.join('input','1.1')%0A    output_path = os.path.join('output','1.1')%0A%0A    def test_to_text_11_test(self):%0A        input_filenames = glob.glob(os.path.join(self.input_path,'*.xml'))%0A        for input_filename in input_filenames:%0A            input_file = open(input_filename, 'r')%0A            input_text = input_file.read()%0A            %0A            # parse the file to a TAXII message/object%0A            msg_from_xml = tm11.get_message_from_xml(input_text)%0A            %0A            # serialize the object to XML and text%0A            xml_from_msg = msg_from_xml.to_xml(True)%0A            txt_from_msg = msg_from_xml.to_text()%0A            %0A            # create the output files%0A            basename = os.path.basename(input_filename)%0A            name_no_ext = os.path.splitext(basename)%5B0%5D%0A            %0A            txt_output_filename = os.path.join(self.output_path, name_no_ext + %22.txt%22)%0A            xml_output_filename = os.path.join(self.output_path, name_no_ext + %22.xml%22)%0A        %0A            txt_output_file = open(txt_output_filename, 'w')%0A            xml_output_file = open(xml_output_filename, 'w')%0A            %0A            # write XML and text to files.%0A            txt_output_file.write(txt_from_msg)%0A            xml_output_file.write(xml_from_msg)%0A            %0A            txt_output_file.close()%0A            xml_output_file.close()%0A                        %0Aif __name__ == '__main__':%0A    unittest.main()%0A%0A

Test to parse & serialize test documents to XML and text.