diff options
Diffstat (limited to 'beancount_extras_kris7t/plugins/transfer_accounts_test.py')
-rw-r--r-- | beancount_extras_kris7t/plugins/transfer_accounts_test.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/beancount_extras_kris7t/plugins/transfer_accounts_test.py b/beancount_extras_kris7t/plugins/transfer_accounts_test.py index 0883522..a80b70c 100644 --- a/beancount_extras_kris7t/plugins/transfer_accounts_test.py +++ b/beancount_extras_kris7t/plugins/transfer_accounts_test.py | |||
@@ -3,13 +3,13 @@ __license__ = 'GNU GPLv2' | |||
3 | 3 | ||
4 | import unittest | 4 | import unittest |
5 | 5 | ||
6 | from beancount import loader | 6 | from beancount.loader import load_doc |
7 | from beancount.parser import cmptest | 7 | from beancount.parser import cmptest |
8 | 8 | ||
9 | 9 | ||
10 | class TestTransferAccounts(cmptest.TestCase): | 10 | class TestTransferAccounts(cmptest.TestCase): |
11 | 11 | ||
12 | @loader.load_doc() | 12 | @load_doc() |
13 | def test_same_currency(self, entries, _, __): | 13 | def test_same_currency(self, entries, _, __): |
14 | ''' | 14 | ''' |
15 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 15 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -40,7 +40,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
40 | Liabilities:CreditCard -20 USD | 40 | Liabilities:CreditCard -20 USD |
41 | ''', entries) | 41 | ''', entries) |
42 | 42 | ||
43 | @loader.load_doc() | 43 | @load_doc() |
44 | def test_missing_date(self, entries, _, __): | 44 | def test_missing_date(self, entries, _, __): |
45 | ''' | 45 | ''' |
46 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 46 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -70,7 +70,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
70 | Liabilities:CreditCard -20 USD | 70 | Liabilities:CreditCard -20 USD |
71 | ''', entries) | 71 | ''', entries) |
72 | 72 | ||
73 | @loader.load_doc(expect_errors=True) | 73 | @load_doc(expect_errors=True) |
74 | def test_missing_account_with_date(self, _, errors, __): | 74 | def test_missing_account_with_date(self, _, errors, __): |
75 | ''' | 75 | ''' |
76 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 76 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -86,7 +86,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
86 | ''' | 86 | ''' |
87 | self.assertRegex(errors[0].message, 'transfer-date was set but transfer-account was not') | 87 | self.assertRegex(errors[0].message, 'transfer-date was set but transfer-account was not') |
88 | 88 | ||
89 | @loader.load_doc(expect_errors=True) | 89 | @load_doc(expect_errors=True) |
90 | def test_missing_account_with_conversion(self, _, errors, __): | 90 | def test_missing_account_with_conversion(self, _, errors, __): |
91 | ''' | 91 | ''' |
92 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 92 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -103,7 +103,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
103 | self.assertRegex( | 103 | self.assertRegex( |
104 | errors[0].message, 'transfer-converted was set but transfer-account was not') | 104 | errors[0].message, 'transfer-converted was set but transfer-account was not') |
105 | 105 | ||
106 | @loader.load_doc(expect_errors=True) | 106 | @load_doc(expect_errors=True) |
107 | def test_invalid_account(self, _, errors, __): | 107 | def test_invalid_account(self, _, errors, __): |
108 | ''' | 108 | ''' |
109 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 109 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -119,7 +119,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
119 | ''' | 119 | ''' |
120 | self.assertRegex(errors[0].message, 'transfer-account must be a string.*') | 120 | self.assertRegex(errors[0].message, 'transfer-account must be a string.*') |
121 | 121 | ||
122 | @loader.load_doc(expect_errors=True) | 122 | @load_doc(expect_errors=True) |
123 | def test_invalid_date(self, _, errors, __): | 123 | def test_invalid_date(self, _, errors, __): |
124 | ''' | 124 | ''' |
125 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 125 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -136,7 +136,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
136 | ''' | 136 | ''' |
137 | self.assertRegex(errors[0].message, 'transfer-date must be a date.*') | 137 | self.assertRegex(errors[0].message, 'transfer-date must be a date.*') |
138 | 138 | ||
139 | @loader.load_doc(expect_errors=True) | 139 | @load_doc(expect_errors=True) |
140 | def test_invalid_conversion(self, _, errors, __): | 140 | def test_invalid_conversion(self, _, errors, __): |
141 | ''' | 141 | ''' |
142 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 142 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -153,7 +153,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
153 | ''' | 153 | ''' |
154 | self.assertRegex(errors[0].message, 'transfer-converted must be a Boolean.*') | 154 | self.assertRegex(errors[0].message, 'transfer-converted must be a Boolean.*') |
155 | 155 | ||
156 | @loader.load_doc(expect_errors=True) | 156 | @load_doc(expect_errors=True) |
157 | def test_invalid_account_conversion(self, _, errors, __): | 157 | def test_invalid_account_conversion(self, _, errors, __): |
158 | ''' | 158 | ''' |
159 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 159 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -163,7 +163,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
163 | ''' | 163 | ''' |
164 | self.assertRegex(errors[0].message, 'transfer-converted must be a Boolean.*') | 164 | self.assertRegex(errors[0].message, 'transfer-converted must be a Boolean.*') |
165 | 165 | ||
166 | @loader.load_doc(expect_errors=True) | 166 | @load_doc(expect_errors=True) |
167 | def test_redundant_conversion(self, _, errors, __): | 167 | def test_redundant_conversion(self, _, errors, __): |
168 | ''' | 168 | ''' |
169 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 169 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -181,7 +181,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
181 | self.assertRegex( | 181 | self.assertRegex( |
182 | errors[0].message, 'transfer-converted was set, but there is no conversion.*') | 182 | errors[0].message, 'transfer-converted was set, but there is no conversion.*') |
183 | 183 | ||
184 | @loader.load_doc() | 184 | @load_doc() |
185 | def test_converted_price_false(self, entries, _, __): | 185 | def test_converted_price_false(self, entries, _, __): |
186 | ''' | 186 | ''' |
187 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 187 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -213,7 +213,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
213 | Liabilities:CreditCard -25.60 CAD | 213 | Liabilities:CreditCard -25.60 CAD |
214 | ''', entries) | 214 | ''', entries) |
215 | 215 | ||
216 | @loader.load_doc() | 216 | @load_doc() |
217 | def test_converted_price_true(self, entries, _, __): | 217 | def test_converted_price_true(self, entries, _, __): |
218 | ''' | 218 | ''' |
219 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 219 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -245,7 +245,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
245 | Liabilities:CreditCard -20 USD | 245 | Liabilities:CreditCard -20 USD |
246 | ''', entries) | 246 | ''', entries) |
247 | 247 | ||
248 | @loader.load_doc() | 248 | @load_doc() |
249 | def test_converted_price_default(self, entries, _, __): | 249 | def test_converted_price_default(self, entries, _, __): |
250 | ''' | 250 | ''' |
251 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 251 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -276,7 +276,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
276 | Liabilities:CreditCard -20 USD | 276 | Liabilities:CreditCard -20 USD |
277 | ''', entries) | 277 | ''', entries) |
278 | 278 | ||
279 | @loader.load_doc() | 279 | @load_doc() |
280 | def test_converted_price_account_false(self, entries, _, __): | 280 | def test_converted_price_account_false(self, entries, _, __): |
281 | ''' | 281 | ''' |
282 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 282 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -308,7 +308,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
308 | Liabilities:CreditCard -25.60 CAD | 308 | Liabilities:CreditCard -25.60 CAD |
309 | ''', entries) | 309 | ''', entries) |
310 | 310 | ||
311 | @loader.load_doc() | 311 | @load_doc() |
312 | def test_converted_price_account_true(self, entries, _, __): | 312 | def test_converted_price_account_true(self, entries, _, __): |
313 | ''' | 313 | ''' |
314 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 314 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -340,7 +340,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
340 | Liabilities:CreditCard -20 USD | 340 | Liabilities:CreditCard -20 USD |
341 | ''', entries) | 341 | ''', entries) |
342 | 342 | ||
343 | @loader.load_doc() | 343 | @load_doc() |
344 | def test_converted_cost_false(self, entries, _, __): | 344 | def test_converted_cost_false(self, entries, _, __): |
345 | ''' | 345 | ''' |
346 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 346 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -372,7 +372,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
372 | Liabilities:CreditCard -25.60 CAD | 372 | Liabilities:CreditCard -25.60 CAD |
373 | ''', entries) | 373 | ''', entries) |
374 | 374 | ||
375 | @loader.load_doc() | 375 | @load_doc() |
376 | def test_converted_cost_true(self, entries, _, __): | 376 | def test_converted_cost_true(self, entries, _, __): |
377 | ''' | 377 | ''' |
378 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 378 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -404,7 +404,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
404 | Liabilities:CreditCard -20 USD {1.28 CAD, 2020-03-15} | 404 | Liabilities:CreditCard -20 USD {1.28 CAD, 2020-03-15} |
405 | ''', entries) | 405 | ''', entries) |
406 | 406 | ||
407 | @loader.load_doc() | 407 | @load_doc() |
408 | def test_converted_cost_and_price_false(self, entries, _, __): | 408 | def test_converted_cost_and_price_false(self, entries, _, __): |
409 | ''' | 409 | ''' |
410 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 410 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -436,7 +436,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
436 | Liabilities:CreditCard -25.60 CAD | 436 | Liabilities:CreditCard -25.60 CAD |
437 | ''', entries) | 437 | ''', entries) |
438 | 438 | ||
439 | @loader.load_doc() | 439 | @load_doc() |
440 | def test_converted_cost_and_price_true(self, entries, _, __): | 440 | def test_converted_cost_and_price_true(self, entries, _, __): |
441 | ''' | 441 | ''' |
442 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 442 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -468,7 +468,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
468 | Liabilities:CreditCard -20 USD {1.28 CAD, 2020-03-15} | 468 | Liabilities:CreditCard -20 USD {1.28 CAD, 2020-03-15} |
469 | ''', entries) | 469 | ''', entries) |
470 | 470 | ||
471 | @loader.load_doc() | 471 | @load_doc() |
472 | def test_multiple_separate(self, entries, _, __): | 472 | def test_multiple_separate(self, entries, _, __): |
473 | ''' | 473 | ''' |
474 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 474 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -508,7 +508,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
508 | Liabilities:CreditCard -25 USD | 508 | Liabilities:CreditCard -25 USD |
509 | ''', entries) | 509 | ''', entries) |
510 | 510 | ||
511 | @loader.load_doc() | 511 | @load_doc() |
512 | def test_multiple_merge(self, entries, _, __): | 512 | def test_multiple_merge(self, entries, _, __): |
513 | ''' | 513 | ''' |
514 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 514 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -545,7 +545,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
545 | Liabilities:CreditCard -45 USD | 545 | Liabilities:CreditCard -45 USD |
546 | ''', entries) | 546 | ''', entries) |
547 | 547 | ||
548 | @loader.load_doc() | 548 | @load_doc() |
549 | def test_multiple_currencies_merge_converted_false(self, entries, _, __): | 549 | def test_multiple_currencies_merge_converted_false(self, entries, _, __): |
550 | ''' | 550 | ''' |
551 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 551 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |
@@ -583,7 +583,7 @@ class TestTransferAccounts(cmptest.TestCase): | |||
583 | Liabilities:CreditCard -50.60 CAD | 583 | Liabilities:CreditCard -50.60 CAD |
584 | ''', entries) | 584 | ''', entries) |
585 | 585 | ||
586 | @loader.load_doc() | 586 | @load_doc() |
587 | def test_multiple_currencies_merge_converted_true(self, entries, _, __): | 587 | def test_multiple_currencies_merge_converted_true(self, entries, _, __): |
588 | ''' | 588 | ''' |
589 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" | 589 | plugin "beancount_extras_kris7t.plugins.transfer_accounts" |