@@ -0,0 +1,2870 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport sys%0Aimport unittest%0Aimport logging%0A%0Asys.path.append('..')%0Asys.path.append('../lib')%0Aimport parse%0Afrom patXML import *%0A%0Abasedir = os.path.dirname(__file__)%0Atestdir = os.path.join(basedir, './fixtures/xml/')%0Atestfileone = 'ipg120327.one.xml'%0Atestfiletwo = 'ipg120327.two.xml'%0Axmlclasses = %5BAssigneeXML, CitationXML, ClassXML, InventorXML, %5C%0A              PatentXML, PatdescXML, LawyerXML, ScirefXML, UsreldocXML%5D%0A%0Aclass TestParseFile(unittest.TestCase):%0A    %0A    def setUp(self):%0A        pass%0A%0A    def test_parse_file_one(self):%0A        parsed_output = parse.parse_file(testdir+testfileone)%0A        self.assertTrue(isinstance(parsed_output, list))%0A        self.assertTrue(len(parsed_output) == 1)%0A        self.assertTrue(isinstance(parsed_output%5B0%5D, str))%0A%0A    def test_parallel_parse_one(self):%0A        filelist = %5Btestdir+testfileone%5D%0A        parsed_output = parse.parallel_parse(filelist)%0A        self.assertTrue(isinstance(parsed_output,list))%0A        self.assertTrue(len(parsed_output) == 1)%0A        self.assertTrue(isinstance(parsed_output%5B0%5D,list))%0A        self.assertTrue(len(parsed_output%5B0%5D) == 1)%0A        self.assertTrue(isinstance(parsed_output%5B0%5D%5B0%5D, str))%0A%0A    def test_parse_file_two(self):%0A        parsed_output = parse.parse_file(testdir+testfiletwo)%0A        self.assertTrue(isinstance(parsed_output, list))%0A        self.assertTrue(len(parsed_output) == 2)%0A        self.assertTrue(isinstance(parsed_output%5B0%5D, str))%0A        self.assertTrue(isinstance(parsed_output%5B1%5D, str))%0A%0A    def test_parallel_parse_two(self):%0A        filelist = %5Btestdir+testfiletwo%5D%0A        parsed_output = parse.parallel_parse(filelist)%0A        self.assertTrue(isinstance(parsed_output,list))%0A        self.assertTrue(len(parsed_output) == 1)%0A        self.assertTrue(isinstance(parsed_output%5B0%5D,list))%0A        self.assertTrue(len(parsed_output%5B0%5D) == 2)%0A        self.assertTrue(isinstance(parsed_output%5B0%5D%5B0%5D, str))%0A        self.assertTrue(isinstance(parsed_output%5B0%5D%5B1%5D, str))%0A    %0A    def test_use_parallel_parse_one(self):%0A        filelist = %5Btestdir+testfileone%5D%0A        parsed_output = parse.parallel_parse(filelist)%0A        parsed_xml = %5Bxmlclass(parsed_output%5B0%5D%5B0%5D) for xmlclass in xmlclasses%5D%0A        self.assertTrue(len(parsed_xml) == len(xmlclasses))%0A        self.assertTrue(all(parsed_xml))%0A%0A    def test_use_parallel_parse_two(self):%0A        filelist = %5Btestdir+testfiletwo%5D%0A        parsed_output = parse.parallel_parse(filelist)%0A        parsed_xml = %5B%5D%0A        for us_patent_grant in parsed_output%5B0%5D:%0A            self.assertTrue(isinstance(us_patent_grant, str))%0A            for xmlclass in xmlclasses:%0A                parsed_xml.append(xmlclass(us_patent_grant))%0A        self.assertTrue(len(parsed_xml) == 2 * len(xmlclasses))%0A        self.assertTrue(all(parsed_xml))%0A        %0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A

add unit tests for test_parse_file