-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patheasyBankcsv2qif_test.py
178 lines (137 loc) · 7.6 KB
/
easyBankcsv2qif_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import unittest
from easyBankcsv2qif import Transaction
# some globals
defaultAccount = "OPSKATWW AT120000120340560780"
class TestTransaction(unittest.TestCase):
def setUp(self):
pass
def gTdesc(self, desc):
""" get_Transaction_set_Description
is a shortcut function to init a Transaction
with default values and a custom description since we mostly test
parsing the description
"""
v = ["AT1234", # account
desc, # description
"01.08.2013", # date
"02.08.2013", # valutadate
"+1200,00", # amount
"EUR"] # currency
t = Transaction()
t.setTransaction(v[0], # account
v[1], # description
v[2], # date
v[3], # valutadate
v[4], # amount
v[5]) # currency
return t
def testBasics(self):
""" test the basic value setting
"""
t = Transaction()
t = self.gTdesc("some description")
self.assertEqual(t.account, "AT1234")
self.assertEqual(t.description, "some description")
self.assertEqual(t.date, "01.08.2013")
self.assertEqual(t.valutadate, "02.08.2013")
self.assertEqual(t.amount, "+1200,00")
self.assertEqual(t.currency, "EUR")
def testUeberweisung1(self):
t = self.gTdesc("Startkapital fuer Haushaltskonto von BG/000000002 {} Denner Bernhard Bernhard".format(defaultAccount))
self.assertEqual(t.type, "BG")
self.assertEqual(t.htype, "transfer")
self.assertEqual(t.memo, "Startkapital fuer Haushaltskonto von Bernhard")
self.assertEqual(t.payee, "Denner Bernhard ({})".format(defaultAccount))
def testUeberweisung2(self):
t = self.gTdesc("Gutschrift Onlinebanking BG/000000036 {} Denner Bernhard Linux Magazin via Kreditkarte Linux New Media AG".format(defaultAccount))
self.assertEqual(t.type, "BG")
self.assertEqual(t.htype, "transfer")
self.assertEqual(t.memo, "Gutschrift Onlinebanking Linux Magazin via Kreditkarte Linux New Media AG")
self.assertEqual(t.payee, "Denner Bernhard ({})".format(defaultAccount))
def testUeberweisung2(self):
t = self.gTdesc("monatliches Budget BG/000000093 {} Denner Bernhard".format(defaultAccount))
self.assertEqual(t.type, "BG")
self.assertEqual(t.htype, "transfer")
self.assertEqual(t.memo, "monatliches Budget")
self.assertEqual(t.payee, "Denner Bernhard ({})".format(defaultAccount))
def testAuszahlung1(self):
t = self.gTdesc("Auszahlung Maestro 4 20:26K1 MC/000000151 25 00000100 MAESTRO ATM 14.07.14 20:26K1 SOCIETE GENERALE\\\\ARLE S\\132000 2500340 ")
self.assertEqual(t.type, "MC")
self.assertEqual(t.htype, "withdraw")
self.assertEqual(t.memo, "Auszahlung Maestro (4 20:26K1) 25 00000100 MAESTRO ATM 14.07.14 20:26K1 SOCIETE GENERALE\\\\ARLE S\\132000 2500340")
self.assertEqual(t.payee, None)
def testAuszahlung1(self):
t = self.gTdesc("Auszahlung Maestro 18.39 MC/000000007 AUTOMAT S6EE0160 K1 29.08.UM 18.39 ")
self.assertEqual(t.type, "MC")
self.assertEqual(t.htype, "withdraw")
self.assertEqual(t.memo, "Auszahlung Maestro (18.39) AUTOMAT S6EE0160 K1 29.08.UM 18.39")
self.assertEqual(t.payee, None)
def testZahlung1(self):
t = self.gTdesc("Bezahlung Maestro 16.35 MC/000000005 LUTZ DANKT 8834 K1 22.08.UM 16.35 XXXLUTZ 8834\\\\LAA AN D ER TH\\21 040 ")
self.assertEqual(t.type, "MC")
self.assertEqual(t.htype, "payment")
self.assertEqual(t.memo, "Bezahlung Maestro (16.35) LUTZ DANKT 8834 K1 22.08.UM 16.35 XXXLUTZ 8834\\\\LAA AN D ER TH\\21 040")
self.assertEqual(t.payee, None)
def testZahlung2(self):
t = self.gTdesc("MERKUR DANKT 3750P K1 03.09. UM 19.06 VD/000000009 ")
self.assertEqual(t.type, "VD")
self.assertEqual(t.htype, "payment")
self.assertEqual(t.memo, "MERKUR DANKT 3750P K1 03.09. UM 19.06")
self.assertEqual(t.payee, None)
def testZahlung3(self):
t = self.gTdesc("MERKUR DANKT 3750P K1 03.09. UM 19.06 VD/000000009 ")
self.assertEqual(t.type, "VD")
self.assertEqual(t.htype, "payment")
self.assertEqual(t.memo, "MERKUR DANKT 3750P K1 03.09. UM 19.06")
self.assertEqual(t.payee, None)
def testZahlung4(self):
t = self.gTdesc("www.hochkar.com /1228 AE120932 OG/000000049 35000 00000069682 HOBEX AG ")
self.assertEqual(t.type, "OG")
self.assertEqual(t.htype, "payment")
self.assertEqual(t.memo, "www.hochkar.com /1228 AE120932 35000 00000069682 HOBEX AG")
self.assertEqual(t.payee, None)
def testZahlung5(self):
t = self.gTdesc("Vorschreibung 09/14-10/14 + Nachverr. 08/14-08/14 (Betrag enthaelt 10%U St: EUR 4 ,85), 2153, Patzenthal 7 OG/000000186 RZBAATWWXXX AT673100000404011011 GIS Gebuehren Info Service GmbH (FN ")
self.assertEqual(t.type, "OG")
self.assertEqual(t.htype, "payment")
self.assertEqual(t.memo, "Vorschreibung 09/14-10/14 + Nachverr. 08/14-08/14 (Betrag enthaelt 10%U St: EUR 4 ,85), 2153, Patzenthal 7 RZBAATWWXXX AT673100000404011011 GIS Gebuehren Info Service GmbH (FN")
self.assertEqual(t.payee, None)
# also known as financial institute fee (FI fee)
def testBankFee1(self):
t = self.gTdesc("Kontoeroeffnung BG/000000001 ")
self.assertEqual(t.type, "BG")
self.assertEqual(t.htype, "bankfee")
self.assertEqual(t.memo, "Kontoeroeffnung")
self.assertEqual(t.payee, None)
def testBankFee2(self):
t = self.gTdesc("BG/000000052 Entgelt fuer Kontofuehrung ")
self.assertEqual(t.type, "BG")
self.assertEqual(t.htype, "bankfee")
self.assertEqual(t.memo, "Entgelt fuer Kontofuehrung")
self.assertEqual(t.payee, None)
def testBankFee3(self):
t = self.gTdesc("RI/000000121 Entgelt fuer Mahnung ")
self.assertEqual(t.type, "RI")
self.assertEqual(t.htype, "bankfee")
self.assertEqual(t.memo, "Entgelt fuer Mahnung")
self.assertEqual(t.payee, None)
def testCreditCardBill1(self):
t = self.gTdesc("easy kreditkarte VISA MC/000000338 Abrechnung Nr. 000000020")
self.assertEqual(t.type, "MC")
self.assertEqual(t.htype, "credit card bill")
self.assertEqual(t.memo, "easy kreditkarte VISA Abrechnung Nr. 000000020")
self.assertEqual(t.payee, None)
def testOnlineTransaction(self):
t = self.gTdesc("Abbuchung Onlinebanking 100270564074 FE/000002769 AT813100000000156109 OEAMTC")
self.assertEqual(t.type, "FE")
self.assertEqual(t.htype, "transfer")
self.assertEqual(t.memo, "OEAMTC")
self.assertEqual(t.payee, "OEAMTC (AT813100000000156109)")
def testCashWithdrawal(self):
t = self.gTdesc("Auszahlung Karte BG/000002778 AUTOMAT S6EE5039 0063 Karte3 12.05.2017 UM 08:32")
self.assertEqual(t.type, "BG")
self.assertEqual(t.htype, "withdraw")
self.assertEqual(t.memo, "Auszahlung Karte AUTOMAT S6EE5039 0063 Karte3 12.05.2017 UM 08:32")
self.assertEqual(t.payee, None)
if __name__ == '__main__':
unittest.main()