Beispiel #1
0
 def testCondense(self):
     bl = [type1Line( '1 blah 2 blah 3 blah 4 blah 5', ch )]
     assumptions = assumptionsList( bl )
     spec = assumptionSpec()
     spec.mark_cruft(1)
     spec.mark_total(2)
     spec.mark_grand_total(3)
     self.assertEqual( assumptions[0].condense( spec ), [1, 3, 4] )
Beispiel #2
0
 def setUp(self):
     ch = categoryHinter( os.path.join('config', 'test-categories.conf') )
     bl = [type1Line( ' x 2007', ch )]
     bl.append( type1Line('', ch) )
     bl.append( type1Line('', ch) )
     bl.append( type1Line('', ch) )
     bl.append( type1Line('x 1. dues 10000', ch) )
     self.assumption = assumptionsList( bl )[0]
     self.assumption_spec = assumptionSpec()
     self.engine = penaltyEngine( self.assumption, self.assumption_spec )
Beispiel #3
0
#!/usr/bin/python

import os,sys,re,csv
sys.path.append( os.getcwd() )
from renumerate.CategoryHint import categoryHinter
from renumerate.PenaltyEngine import penaltyEngine
from renumerate.IncomeStatement import incomeStatement
from renumerate.PursueTotals import assumptionSpec

spec = assumptionSpec()
ch = categoryHinter( 'config/test-jcategories.conf' )
pe = penaltyEngine

path='/home/bennett//Desktop/Work/Research/NPO-financials/financials/pdf/naikakufu/'

unpaper='unpaper -bn v,h -bs 3 -bd 100 -bp 2 -bt 0.9 -bi 0.95 -li 0.01 --overwrite --deskew-scan-step 0.05 --no-noisefilter --grayfilter-size 5 --grayfilter-step 1 --grayfilter-threshold 0.1'

filename = os.path.split( sys.argv[1] )[-1]
filename = os.path.splitext( filename )[0]
filename = filename.decode('utf8')
filename = filename.encode('utf8')

def analyze( text=None):
    if not text:
        text = open('RDATA.txt').read().decode('utf8')
    incomer = incomeStatement( ch, pe )
    incomer.read( text )
    incomer.analyze()
    data = []
    for section in ch.ordered_sections():
        data.append( [] )
Beispiel #4
0
 def testAssumptionLength(self):
     bl = [type1Line( '1 blah 2 blah 3', ch )]
     assumptions = assumptionsList( bl )
     spec = assumptionSpec()
     spec.mark_cruft(1)
     self.assertEqual( assumptions[0].length( spec ), 2)
Beispiel #5
0
 def testInstantiation(self):
     spec = assumptionSpec()
     self.assertFalse( spec.NON_TOTAL == spec.TOTAL )
Beispiel #6
0
 def testSpecKeyExists(self):
     assumption = self.assumptions[0]
     as = assumptionSpec()
     as['wowza'] = 'whoopie'
     self.assertEqual( as['wowza'], 'whoopie' )
Beispiel #7
0
    def setUp(self):
        self.ch = testCH()
        self.ch.read( os.path.join('config', 'test-categories.conf') )
        bl = [type1Line( 'project 100 blah 100 blah 200', self.ch )]
        self.assumptions = assumptionsList( bl, 'type1' )
        self.assumption = self.assumptions[0]

    def testUnwindTotal(self):
        as = assumptionSpec()
        as.mark_total(1)
        as.mark_total(2)
        new_as = as.unwind_total()
        self.assertEqual( new_as[2], as.NON_TOTAL )
        
    def testSpecAsList(self):
        as = assumptionSpec()
        as.mark_total(1)
        as.mark_total(2)
        self.assertEqual( as.spec_as_list(), [(1,1),(2,1)] )
        
    def testUnwindTotalScopeOfUnwind(self):
        as = assumptionSpec()
        as.mark_total(1)
        as.mark_total(2)
        as.unwind_total()
        self.assertEqual( as[1], as.TOTAL )
        
    def testMarkCruftCount(self):
        as = assumptionSpec()
        as.mark_cruft(1)
        self.assertEqual( as.cruft_count(), 1 )