Exemple #1
0
 def test_parse_patent(self):
     patentroot = '.'
     testdir = [os.path.join(basedir, './fixtures/xml')]
     xmlregex = r'ipg120327.one.xml'
     filelist = parse.list_files(testdir, patentroot, xmlregex)
     grant_list = parse.parallel_parse(filelist)
     parsed_grants = parse.parse_patent(grant_list)
     self.assertTrue(len(list(parsed_grants)) == len(grant_list)*len(xmlclasses))
Exemple #2
0
sys.path.append('..')
from couch_patent import *

sys.path.append('../lib/')
from patXML import *

import parse

basedir = os.path.join(os.curdir, '../test')
testdir = os.path.join(basedir, 'fixtures/xml/')
testfile = XMLPatentBase(open(testdir + 'ipg120327.one.xml').read())
patentroot = '.'
xmlregex = r'ipg120327.one.xml'
filelist = parse.list_files([testdir], patentroot, xmlregex)
grant_list = parse.parallel_parse(filelist)
parsed_grants = list(parse.parse_patent(grant_list))


class TestCouchPatent(unittest.TestCase):
    def setUp(self):
        self.assertTrue(testfile)

    def test_get_doc_metadata(self):
        """
        Tests that get_metadata retrieves the requisite information from a
        parsed xml file
        """
        metadata = get_metadata(parsed_grants[0])
        self.assertTrue(isinstance(metadata, dict))
        self.assertTrue(metadata['publication_id'] == parsed_grants[0].patent)
        self.assertTrue(
sys.path.append('..')
from couch_patent import *

sys.path.append('../lib/')
from patXML import *

import parse

basedir = os.path.join(os.curdir, '../test')
testdir = os.path.join(basedir, 'fixtures/xml/')
testfile = XMLPatentBase(open(testdir+'ipg120327.one.xml').read())
patentroot = '.'
xmlregex = r'ipg120327.one.xml'
filelist = parse.list_files([testdir], patentroot, xmlregex)
grant_list = parse.parallel_parse(filelist)
parsed_grants = list(parse.parse_patent(grant_list))

class TestCouchPatent(unittest.TestCase):

    def setUp(self):
        self.assertTrue(testfile)

    def test_get_doc_metadata(self):
        """
        Tests that get_metadata retrieves the requisite information from a
        parsed xml file
        """
        metadata = get_metadata(parsed_grants[0])
        self.assertTrue(isinstance(metadata, dict))
        self.assertTrue(metadata['publication_id'] == parsed_grants[0].patent)
        self.assertTrue(metadata['application_id'] == parsed_grants[0].patent_app)