<commit_before>#!/usr/bin/env python

import unittest
import imp
from yaml import load, dump

from  xml_patent import XMLPatent

#imp.load_source("xml_patent", ".")

xmlfile = open('xml/ipg120327.one.xml')

class TestXMLPatent(unittest.TestCase):

    def setUp(self):
        self.foo = 'bar'

    def test_dummy(self):
        assert(1 == 1)

    def test_patent(self):
        attlist = XMLPatent(xmlfile.read())
        #print attlist
        # Assert against whatever python uses for array or list
        # element presence.
        assert(attlist)


if __name__ == '__main__':
    unittest.main()<commit_msg>Adding basic xml unit-testing framework<commit_after>#!/usr/bin/env python

import unittest
import sys
import imp
import os
from xml.dom.minidom import parse, parseString
from yaml import load, dump
from xml_patent import XMLPatent

dir = os.path.dirname(__file__) # Store directory of file 
test_folder = os.path.join(dir, 'xml/unittest') # Folder path with xml unit test files
log_folder = os.path.join(dir, 'xml/unittest/xml-parsing-log.txt') # Folder path unit test log

open(logfile, 'w') # Erase the log and start over for each run (just a test)
logging.basicConfig(filename=logfile, level=logging.DEBUG) # Set up log in case its needed


t1 = datetime.datetime.now() #set up time in case it will be used

files = [x for x in os.listdir(test_folder)
         if re.match(r"unit-test.xml", x, re.I)!=None] # list collection of files to be used for unit-testing

xml_file = open(('xml/ipg120327.one.xml'), 'U') #example file


class TestXMLPatent(unittest.TestCase):

    def setUp(self):
        

    def test_dummy(self):
        assert(1 == 1)

    def test_patent(self):

        

if __name__ == '__main__':
    unittest.main()




    
    
{'fraction_non_alphanumeric': 0.1087202718006795, 'fraction_numerical': 0.009626274065685165, 'mean_word_length': 3.373762376237624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 17}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4003533', 'n_tokens_mistral': 603, 'n_tokens_neox': 568, 'n_words': 173}