<s> import unittest <EOL> from pledger . parser import Parser <EOL> class AccountTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . parser = Parser ( ) <EOL> self . account = self . parser . parse_account ( "<STR_LIT>" ) <EOL> def testAccountAdd ( self ) : <EOL> amount = self . parser . parse_value ( "<STR_LIT>" ) <EOL> entry = self . account + amount <EOL> self . assertEqual ( self . account , entry . account ) <EOL> self . assertEqual ( amount , entry . amount ) <EOL> def testAccountSub ( self ) : <EOL> amount = self . parser . parse_value ( "<STR_LIT>" ) <EOL> entry = self . account - amount <EOL> self . assertEqual ( self . account , entry . account ) <EOL> self . assertEqual ( - amount , entry . amount ) <EOL> def testRoot ( self ) : <EOL> self . assertEqual ( self . parser . accounts [ "<STR_LIT>" ] , self . account . root ( ) ) <EOL> def testShortenedName ( self ) : <EOL> account = self . account [ "<STR_LIT>" ] <EOL> size = <NUM_LIT:30> <EOL> name = account . shortened_name ( size ) <EOL> self . assertLessEqual ( len ( name ) , size ) <EOL> self . assertEqual ( <NUM_LIT:7> , len ( filter ( lambda x : x == '<STR_LIT::>' , name ) ) ) <EOL> def testSubName ( self ) : <EOL> account = self . account [ "<STR_LIT>" ] <EOL> self . assertEqual ( u'<STR_LIT>' , self . account . parent . sub_name ( account ) ) <EOL> self . assertIsNone ( self . account . sub_name ( self . parser . accounts [ "<STR_LIT>" ] ) ) </s>
