formatting, optimize code

This commit is contained in:
Frederik Jaeckel 2023-06-06 15:22:57 +02:00
parent 6cf6584f92
commit d0e2c8bc52
10 changed files with 362 additions and 253 deletions

View file

@ -1,27 +1,18 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
# -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds for Tryton.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
import trytond.tests.test_tryton
import unittest
from trytond.modules.cashbook_dataexchange.tests.test_category import CategoryTestCase
from trytond.modules.cashbook_dataexchange.tests.test_party import PartyTestCase
from trytond.modules.cashbook_dataexchange.tests.test_transaction import TransactionTestCase
from .test_module import CashbookExchangeTestCase
__all__ = ['suite']
class CashbookExchangeTestCase(\
CategoryTestCase,\
PartyTestCase,\
TransactionTestCase,\
):
'Test cashbook exchange module'
module = 'cashbook_dataexchange'
# end CashbookExchangeTestCase
def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(CashbookExchangeTestCase))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
CashbookExchangeTestCase))
return suite

View file

@ -5,14 +5,13 @@
from datetime import date
from decimal import Decimal
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.tests.test_tryton import with_transaction
from trytond.pool import Pool
from trytond.transaction import Transaction
from trytond.modules.cashbook.tests import CashbookTestCase
from .qifdata import qif_category, qif_types
from .qifdata import qif_types
class CategoryTestCase(CashbookTestCase):
class CategoryTestCase(object):
'Test cashbook categoy module'
module = 'cashbook_dataexchange'
@ -26,9 +25,8 @@ class CategoryTestCase(CashbookTestCase):
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
'active_model': 'cashbook.category',
}):
'company': company.id,
'active_model': 'cashbook.category'}):
(sess_id, start_state, end_state) = ImportWiz.create()
w_obj = ImportWiz(sess_id)
self.assertEqual(start_state, 'start')
@ -49,8 +47,9 @@ class CategoryTestCase(CashbookTestCase):
self.assertEqual(list(result.keys()), ['view'])
self.assertEqual(result['view']['defaults']['company'], company.id)
self.assertEqual(result['view']['defaults']['info'],
"""The following categories are now imported:\n
self.assertEqual(
result['view']['defaults']['info'],
"""The following categories are now imported:\n
Gehalt (in)
Gehalt/Zulagen (in)
@ -88,10 +87,14 @@ Lebensmittel (out)""")
self.assertEqual(records[8].rec_name, 'Telefon/Telco2-Handy')
self.assertEqual(records[9].rec_name, 'Telefon/Telco3')
self.assertEqual(records[10].rec_name, 'Telekommunikation')
self.assertEqual(records[11].rec_name, 'Telekommunikation/Fernsehen')
self.assertEqual(records[12].rec_name, 'Telekommunikation/Online-Dienste')
self.assertEqual(records[13].rec_name, 'Telekommunikation/Telefon')
self.assertEqual(records[14].rec_name, 'Telekommunikation/Telefon/Test1')
self.assertEqual(
records[11].rec_name, 'Telekommunikation/Fernsehen')
self.assertEqual(
records[12].rec_name, 'Telekommunikation/Online-Dienste')
self.assertEqual(
records[13].rec_name, 'Telekommunikation/Telefon')
self.assertEqual(
records[14].rec_name, 'Telekommunikation/Telefon/Test1')
@with_transaction()
def test_category_create_by_qif_emptydb(self):
@ -102,8 +105,7 @@ Lebensmittel (out)""")
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
}):
'company': company.id}):
records = Category.create_from_qif(qif_types)
records = Category.search([], order=[('rec_name', 'ASC')])
@ -120,10 +122,14 @@ Lebensmittel (out)""")
self.assertEqual(records[8].rec_name, 'Telefon/Telco2-Handy')
self.assertEqual(records[9].rec_name, 'Telefon/Telco3')
self.assertEqual(records[10].rec_name, 'Telekommunikation')
self.assertEqual(records[11].rec_name, 'Telekommunikation/Fernsehen')
self.assertEqual(records[12].rec_name, 'Telekommunikation/Online-Dienste')
self.assertEqual(records[13].rec_name, 'Telekommunikation/Telefon')
self.assertEqual(records[14].rec_name, 'Telekommunikation/Telefon/Test1')
self.assertEqual(
records[11].rec_name, 'Telekommunikation/Fernsehen')
self.assertEqual(
records[12].rec_name, 'Telekommunikation/Online-Dienste')
self.assertEqual(
records[13].rec_name, 'Telekommunikation/Telefon')
self.assertEqual(
records[14].rec_name, 'Telekommunikation/Telefon/Test1')
result = Category.export_as_qif()
self.assertEqual(result, """!Type:Cat
@ -183,8 +189,7 @@ I
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
}):
'company': company.id}):
cat1, = Category.create([{
'name': 'Telekommunikation',
'cattype': 'out',
@ -199,7 +204,7 @@ I
self.assertEqual(records[0].rec_name, 'Telekommunikation')
self.assertEqual(records[1].rec_name, 'Telekommunikation/Telefon')
records1 = Category.create_from_qif(qif_types)
Category.create_from_qif(qif_types)
records = Category.search([], order=[('rec_name', 'ASC')])
self.assertEqual(len(records), 15)
@ -215,10 +220,14 @@ I
self.assertEqual(records[8].rec_name, 'Telefon/Telco2-Handy')
self.assertEqual(records[9].rec_name, 'Telefon/Telco3')
self.assertEqual(records[10].rec_name, 'Telekommunikation')
self.assertEqual(records[11].rec_name, 'Telekommunikation/Fernsehen')
self.assertEqual(records[12].rec_name, 'Telekommunikation/Online-Dienste')
self.assertEqual(records[13].rec_name, 'Telekommunikation/Telefon')
self.assertEqual(records[14].rec_name, 'Telekommunikation/Telefon/Test1')
self.assertEqual(
records[11].rec_name, 'Telekommunikation/Fernsehen')
self.assertEqual(
records[12].rec_name, 'Telekommunikation/Online-Dienste')
self.assertEqual(
records[13].rec_name, 'Telekommunikation/Telefon')
self.assertEqual(
records[14].rec_name, 'Telekommunikation/Telefon/Test1')
@with_transaction()
def test_qiftool_split_types(self):
@ -228,18 +237,25 @@ I
result = QifTool.split_by_type(qif_types)
self.assertEqual(len(result.keys()), 2)
self.assertEqual(result['Cat'], 'NGehalt\nI\n^\nNGehalt:Zulagen\n'+
'I\n^\nNTelekommunikation\nE\n^\nNTelekommunikation:Online-Dienste\n'+
'E\n^\nNTelekommunikation:Telefon\nE\n^\nNTelekommunikation:Telefon:Test1\n'+
'E\n^\nNTelefon:Telco1-Tablett\n'+
'E\n^\nNTelefon:Telco2-Handy\nE\n^\nNTelefon:Telco3\nE\n^\n'+
'NTelekommunikation:Fernsehen\nE\n^\nNFernsehen:TV-Company\nE\n'+
self.assertEqual(
result['Cat'],
'NGehalt\nI\n^\nNGehalt:Zulagen\nI\n^\nNTelekommunikation' +
'\nE\n^\nNTelekommunikation:Online-Dienste\n' +
'E\n^\nNTelekommunikation:Telefon\nE\n^\nN' +
'Telekommunikation:Telefon:Test1\n' +
'E\n^\nNTelefon:Telco1-Tablett\n' +
'E\n^\nNTelefon:Telco2-Handy\nE\n^\nNTelefon:Telco3\nE\n^\n' +
'NTelekommunikation:Fernsehen\nE\n^\nNFernsehen:TV-Company\nE\n' +
'^\nNFernsehen:GEZ\nE\n^\nNLebensmittel\nE\n^')
self.assertEqual(result['Bank'], 'D04.12.2013\nT7,12\nCX\nPOpening Balance\n'+
'L[Bargeld]\n^\nD05.12.2013\nCX\nM05.12/06.42UHR TT TELTOW\nT-29,00\n'+
'PGA NR00002168 BLZ10000000 0\nL[S-Giro]\n^\nD05.12.2013\nCX\nMsome food\n'+
'T-56,37\nPFoodshop Zehlendorf\nLLebensmittel\n^\nD06.12.2013\nCX\n'+
'Mreturn of bottles\nT1,45\nPFoodshop Zehlendorf\nLLebensmittel\n^\n')
self.assertEqual(
result['Bank'],
'D04.12.2013\nT7,12\nCX\n' +
'POpening Balance\nL[Bargeld]\n^\nD05.12.2013\nCX\nM05.12/' +
'06.42UHR TT TELTOW\nT-29,00\n' +
'PGA NR00002168 BLZ10000000 0\nL[S-Giro]\n^\nD05.12.2013' +
'\nCX\nMsome food\nT-56,37\nPFoodshop Zehlendorf\n' +
'LLebensmittel\n^\nD06.12.2013\nCX\nMreturn of bottles\n' +
'T1,45\nPFoodshop Zehlendorf\nLLebensmittel\n^\n')
@with_transaction()
def test_qiftool_convert_transactions(self):
@ -253,8 +269,7 @@ I
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
}):
'company': company.id}):
types = self.prep_type()
books = Book.create([{
'name': 'Cash Book',
@ -313,17 +328,21 @@ I
'company': company.id,
}])
tr_list = QifTool.qif_read_transactions('D04.12.2013\nT7,12\nCX\n'+
'POpening Balance\nL[Bargeld]\n^\nD05.12.2013\nCX\n'+
'M05.12/06.42UHR TT TELTOW\nT-29,00\nPGA NR00002168 BLZ10000000 0\n'+
'L[S-Giro]\n^\nD05.12.2013\nCX\nMsome food\nT-56,37\n'+
'PFoodshop Zehlendorf\nLLebensmittel\n^\nD22.10.2020\n'+
'CX\nMLebensmittel\nT-55,84\nPreal,- Teltow\nLLebensmittel\n'+
'SLebensmittel\nELebensmittel\n$-49,36\nSKosmetik\nEKlopapier\n'+
'$-2,99\nSHaushaltschemie\nESagrotan\n$-3,49\n'+
tr_list = QifTool.qif_read_transactions(
'D04.12.2013\nT7,12\nCX\n' +
'POpening Balance\nL[Bargeld]\n^\nD05.12.2013\nCX\n' +
'M05.12/06.42UHR TT TELTOW\nT-29,00\nPGA NR00002168 ' +
'BLZ10000000 0\n' +
'L[S-Giro]\n^\nD05.12.2013\nCX\nMsome food\nT-56,37\n' +
'PFoodshop Zehlendorf\nLLebensmittel\n^\nD22.10.2020\n' +
'CX\nMLebensmittel\nT-55,84\nPreal,- Teltow\nLLebensmittel\n' +
'SLebensmittel\nELebensmittel\n$-49,36\nSKosmetik\n' +
'EKlopapier\n' +
'$-2,99\nSHaushaltschemie\nESagrotan\n$-3,49\n' +
'S[S-Giro]\nEtransfer out\n$-3,49\n^\n')
(to_create, msg_txt, fail_cnt) = QifTool.convert_transactions_to_create(books[0], tr_list)
(to_create, msg_txt, fail_cnt) = \
QifTool.convert_transactions_to_create(books[0], tr_list)
self.assertEqual(msg_txt, [])
self.assertEqual(to_create, [{
'date': date(2013, 12, 4),
@ -335,11 +354,11 @@ I
}, {
'date': date(2013, 12, 5),
'amount': Decimal('29.00'),
'description': '05.12/06.42UHR TT TELTOW',
'state': 'edit',
'bookingtype': 'mvout',
'booktransf': books[1].id,
'description': 'GA NR00002168 BLZ10000000 0; 05.12/06.42UHR TT TELTOW',
'description':
'GA NR00002168 BLZ10000000 0; 05.12/06.42UHR TT TELTOW',
}, {
'date': date(2013, 12, 5),
'amount': Decimal('56.37'),
@ -377,8 +396,7 @@ I
'amount': Decimal('3.49'),
'description': 'transfer out',
'booktransf': books[1].id,
}],
)],
}])],
}])
Book.write(*[
[books[0]],
@ -394,13 +412,15 @@ I
"""
QifTool = Pool().get('cashbook_dataexchange.qiftool')
result = QifTool.qif_read_transactions('D04.12.2013\nT7,12\nCX\n'+
'POpening Balance\nL[Bargeld]\n^\nD05.12.2013\nCX\n'+
'M05.12/06.42UHR TT TELTOW\nT290,00\nPGA NR00002168 BLZ10000000 0\n'+
'L[S-Giro]\n^\nD05.12.2013\nCX\nMsome food\nT-56,37\n'+
'PFoodshop Zehlendorf\nLLebensmittel\n^\nD22.10.2020\n'+
'CX\nMLebensmittel\nT-55,84\nPreal,- Teltow\nLLebensmittel\n'+
'SLebensmittel\nELebensmittel\n$-49,36\nSKosmetik\nEKlopapier\n'+
result = QifTool.qif_read_transactions(
'D04.12.2013\nT7,12\nCX\n' +
'POpening Balance\nL[Bargeld]\n^\nD05.12.2013\nCX\n' +
'M05.12/06.42UHR TT TELTOW\nT290,00\nPGA ' +
'NR00002168 BLZ10000000 0\n' +
'L[S-Giro]\n^\nD05.12.2013\nCX\nMsome food\nT-56,37\n' +
'PFoodshop Zehlendorf\nLLebensmittel\n^\nD22.10.2020\n' +
'CX\nMLebensmittel\nT-55,84\nPreal,- Teltow\nLLebensmittel\n' +
'SLebensmittel\nELebensmittel\n$-49,36\nSKosmetik\nEKlopapier\n' +
'$-2,99\nSHaushaltschemie\nESagrotan\n$-3,49\n^\n')
self.assertEqual(result, [{
'split': [],
@ -453,7 +473,8 @@ I
"""
QifTool = Pool().get('cashbook_dataexchange.qiftool')
result = QifTool.qif_read_categories('NGehalt\nI\n^\nNGehalt:Zulagen\nI\n^'+
result = QifTool.qif_read_categories(
'NGehalt\nI\n^\nNGehalt:Zulagen\nI\n^' +
'NTelekommunikation\nE\n^\nNTelekommunikation:Online-Dienste\nE\n^')
self.assertEqual(result, {
'in': {

View file

@ -3,15 +3,13 @@
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from datetime import date
from decimal import Decimal
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.tests.test_tryton import with_transaction
from trytond.pool import Pool
from trytond.transaction import Transaction
from .qifdata import qif_types
class PartyTestCase(ModuleTestCase):
class PartyTestCase(object):
'Test cashbook party module'
module = 'cashbook_dataexchange'
@ -25,9 +23,8 @@ class PartyTestCase(ModuleTestCase):
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
'active_model': 'party.party',
}):
'company': company.id,
'active_model': 'party.party'}):
(sess_id, start_state, end_state) = ImportWiz.create()
w_obj = ImportWiz(sess_id)
self.assertEqual(start_state, 'start')

26
tests/test_module.py Normal file
View file

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds for Tryton.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from trytond.tests.test_tryton import ModuleTestCase
from trytond.modules.cashbook.tests.test_module import CashbookTestCase
from .category import CategoryTestCase
from .party import PartyTestCase
from .transaction import TransactionTestCase
class CashbookExchangeTestCase(
CashbookTestCase,
CategoryTestCase,
PartyTestCase,
TransactionTestCase,
ModuleTestCase):
'Test cashbook exchange module'
module = 'cashbook_dataexchange'
# end CashbookExchangeTestCase
del ModuleTestCase

View file

@ -5,13 +5,13 @@
from datetime import date
from decimal import Decimal
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.tests.test_tryton import with_transaction
from trytond.pool import Pool
from trytond.transaction import Transaction
from .qifdata import qif_types
class TransactionTestCase(ModuleTestCase):
class TransactionTestCase(object):
'Test cashbook transaction module'
module = 'cashbook_dataexchange'
@ -26,8 +26,7 @@ class TransactionTestCase(ModuleTestCase):
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
}):
'company': company.id}):
types = self.prep_type()
books = Book.create([{
'name': 'Cash Book',
@ -50,21 +49,24 @@ class TransactionTestCase(ModuleTestCase):
{
'lines': [('create', [{
'date': date(2022, 6, 1),
'bookingtype':'mvout',
'bookingtype': 'mvout',
'amount': Decimal('10.0'),
'booktransf': books[1].id,
'description': 'transfer',
}])],
}])
self.assertEqual(len(books[0].lines), 1)
self.assertEqual(books[0].lines[0].rec_name,
self.assertEqual(
books[0].lines[0].rec_name,
'06/01/2022|to|-10.00 usd|transfer [S-Giro | 0.00 usd | Open]')
self.assertEqual(len(books[1].lines), 0)
Line.wfcheck(books[0].lines)
self.assertEqual(len(books[1].lines), 1)
self.assertEqual(books[1].lines[0].rec_name,
'06/01/2022|from|10.00 usd|transfer [Cash Book | -10.00 usd | Open]')
self.assertEqual(
books[1].lines[0].rec_name,
'06/01/2022|from|10.00 usd|transfer [Cash Book ' +
'| -10.00 usd | Open]')
self.assertEqual(QifTool.check_counter_transaction(books[1], {
'booktransf': books[0].id,
@ -86,9 +88,8 @@ class TransactionTestCase(ModuleTestCase):
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
'active_model': 'cashbook.book',
}):
'company': company.id,
'active_model': 'cashbook.book'}):
types = self.prep_type()
books = Book.create([{
'name': 'Cash Book',
@ -115,13 +116,13 @@ class TransactionTestCase(ModuleTestCase):
Party.create([{
'name': 'GA NR00002168 BLZ10000000 0',
'addresses':[('create', [{}])],
'addresses': [('create', [{}])],
}, {
'name': 'Foodshop Zehlendorf',
'addresses':[('create', [{}])],
'addresses': [('create', [{}])],
}, {
'name': 'Opening Balance',
'addresses':[('create', [{}])],
'addresses': [('create', [{}])],
}])
Category.create([{
@ -151,8 +152,9 @@ class TransactionTestCase(ModuleTestCase):
self.assertEqual(list(result.keys()), ['view'])
self.assertEqual(result['view']['defaults']['company'], company.id)
self.assertEqual(result['view']['defaults']['info'],
"""The following transactionen are now imported:
self.assertEqual(
result['view']['defaults']['info'],
"""The following transactionen are now imported:
Credit: usd7.12
Debit: usd83.92
Balance: -usd76.80
@ -169,10 +171,20 @@ Number of transactions: 4""")
self.assertEqual(len(books[0].lines), 4)
self.assertEqual(books[0].lines[0].rec_name, '12/04/2013|from|7.12 usd|Opening Balance [Bargeld | -7.12 usd | Open]')
self.assertEqual(books[0].lines[1].rec_name, '12/05/2013|to|-29.00 usd|GA NR00002168 BLZ10000000 0; 05.12/06.42 [S-Giro | 29.00 usd | Open]')
self.assertEqual(books[0].lines[2].rec_name, '12/05/2013|Exp|-56.37 usd|some food [Lebensmittel]')
self.assertEqual(books[0].lines[3].rec_name, '12/06/2013|Exp|1.45 usd|return of bottles [Lebensmittel]')
self.assertEqual(
books[0].lines[0].rec_name,
'12/04/2013|from|7.12 usd|Opening Balance ' +
'[Bargeld | -7.12 usd | Open]')
self.assertEqual(
books[0].lines[1].rec_name,
'12/05/2013|to|-29.00 usd|GA NR00002168 BLZ10000000 ' +
'0; 05.12/06.42 [S-Giro | 29.00 usd | Open]')
self.assertEqual(
books[0].lines[2].rec_name,
'12/05/2013|Exp|-56.37 usd|some food [Lebensmittel]')
self.assertEqual(
books[0].lines[3].rec_name,
'12/06/2013|Exp|1.45 usd|return of bottles [Lebensmittel]')
self.assertEqual(Book.export_as_qif(books[0]), """!Type:Bank
D12/04/2013
@ -215,9 +227,8 @@ Mreturn of bottles
company = self.prep_company()
with Transaction().set_context({
'company': company.id,
'active_model': 'cashbook.book',
}):
'company': company.id,
'active_model': 'cashbook.book'}):
types = self.prep_type()
books = Book.create([{
'name': 'From Book',
@ -237,7 +248,7 @@ Mreturn of bottles
Party.create([{
'name': 'Foodshop Zehlendorf',
'addresses':[('create', [{}])],
'addresses': [('create', [{}])],
}])
Category.create([{
@ -283,8 +294,9 @@ L[To Book]
self.assertEqual(list(result.keys()), ['view'])
self.assertEqual(result['view']['defaults']['company'], company.id)
self.assertEqual(result['view']['defaults']['info'],
"""The following transactionen are now imported:
self.assertEqual(
result['view']['defaults']['info'],
"""The following transactionen are now imported:
Credit: usd0.00
Debit: usd57.55
Balance: -usd57.55
@ -302,11 +314,19 @@ Number of transactions: 2""")
self.assertEqual(len(books[0].lines), 2)
self.assertEqual(len(books[1].lines), 1)
self.assertEqual(books[0].lines[0].rec_name, '12/04/2013|to|-7.30 usd|Transfer to book [To Book | 7.30 usd | Open]')
self.assertEqual(
books[0].lines[0].rec_name,
'12/04/2013|to|-7.30 usd|Transfer to book ' +
'[To Book | 7.30 usd | Open]')
self.assertEqual(books[0].lines[0].state, 'check')
self.assertEqual(books[0].lines[1].rec_name, '12/05/2013|Exp|-50.25 usd|some food [Lebensmittel]')
self.assertEqual(
books[0].lines[1].rec_name,
'12/05/2013|Exp|-50.25 usd|some food [Lebensmittel]')
self.assertEqual(books[0].lines[1].state, 'check')
self.assertEqual(books[1].lines[0].rec_name, '12/04/2013|from|7.30 usd|Transfer to book [From Book | -57.55 usd | Open]')
self.assertEqual(
books[1].lines[0].rec_name,
'12/04/2013|from|7.30 usd|Transfer to book ' +
'[From Book | -57.55 usd | Open]')
self.assertEqual(books[1].lines[0].state, 'check')
# run wizard again - import to 'To Book'
@ -359,8 +379,9 @@ $-7,00
self.assertEqual(list(result.keys()), ['view'])
self.assertEqual(result['view']['defaults']['company'], company.id)
self.assertEqual(result['view']['defaults']['info'],
"""The following transactionen are now imported:
self.assertEqual(
result['view']['defaults']['info'],
"""The following transactionen are now imported:
Credit: usd0.00
Debit: usd20.00
Balance: -usd20.00
@ -378,18 +399,37 @@ Number of transactions: 2""")
self.assertEqual(len(books[0].lines), 3)
self.assertEqual(len(books[1].lines), 3)
self.assertEqual(books[0].lines[0].rec_name, '12/04/2013|to|-7.30 usd|Transfer to book [To Book | -12.70 usd | Open]')
self.assertEqual(books[0].lines[0].state, 'check')
self.assertEqual(books[0].lines[1].rec_name, '12/05/2013|Exp|-50.25 usd|some food [Lebensmittel]')
self.assertEqual(books[0].lines[1].state, 'check')
self.assertEqual(books[0].lines[2].rec_name, '12/06/2013|from|7.00 usd|Transfer to From-Book [To Book | -12.70 usd | Open]')
self.assertEqual(books[0].lines[2].state, 'check')
self.assertEqual(
books[0].lines[0].rec_name,
'12/04/2013|to|-7.30 usd|Transfer to book ' +
'[To Book | -12.70 usd | Open]')
self.assertEqual(
books[0].lines[0].state, 'check')
self.assertEqual(
books[0].lines[1].rec_name,
'12/05/2013|Exp|-50.25 usd|some food [Lebensmittel]')
self.assertEqual(
books[0].lines[1].state, 'check')
self.assertEqual(
books[0].lines[2].rec_name,
'12/06/2013|from|7.00 usd|Transfer to From-Book ' +
'[To Book | -12.70 usd | Open]')
self.assertEqual(
books[0].lines[2].state, 'check')
self.assertEqual(books[1].lines[0].rec_name, '12/04/2013|from|7.30 usd|Transfer to book [From Book | -50.55 usd | Open]')
self.assertEqual(
books[1].lines[0].rec_name,
'12/04/2013|from|7.30 usd|Transfer to book [From Book ' +
'| -50.55 usd | Open]')
self.assertEqual(books[1].lines[0].state, 'check')
self.assertEqual(books[1].lines[1].rec_name, '12/06/2013|Exp/Sp|-10.00 usd|Splitbooking with category and account [-]')
self.assertEqual(
books[1].lines[1].rec_name,
'12/06/2013|Exp/Sp|-10.00 usd|Splitbooking with category' +
' and account [-]')
self.assertEqual(books[1].lines[1].state, 'check')
self.assertEqual(books[1].lines[2].rec_name, '12/10/2013|Exp|-10.00 usd|some food [Lebensmittel]')
self.assertEqual(
books[1].lines[2].rec_name,
'12/10/2013|Exp|-10.00 usd|some food [Lebensmittel]')
self.assertEqual(books[1].lines[2].state, 'check')
# end PartyTestCase