~trufas/ledgeroni

ref: 7a9e4ad4a64b45840f93b4ab44b6c2e463e16b13 ledgeroni/conftest.py -rw-r--r-- 1.9 KiB
7a9e4ad4 — Rafael Castillo Clean up stdout 2 years ago
                                                                                
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
from datetime import datetime
import pytest
import arrow
from ledgeroni.types import Transaction, Posting, Commodity

USD = Commodity(is_prefix=True, name='$')

def example_transactions():
    TRANS_1 = Transaction(
        date=arrow.get(datetime(2013, 2, 20)),
        description='Purchased reddit gold for the year')
    TRANS_1.add_posting(Posting(
        account=('Asset', 'Bitcoin Wallet'),
        amounts={None: -10.0}))
    TRANS_1.add_posting(Posting(
        account=('Expense', 'Web Services', 'Reddit'),
        amounts=None))


    TRANS_2 = Transaction(
        date=arrow.get(datetime(2013, 2, 20)),
        description='Spent some cool cash')
    TRANS_2.add_posting(Posting(
        account=('Bank', 'Paypal'),
        amounts={USD: -10.0}))
    TRANS_2.add_posting(Posting(
        account=('Cool', 'Thing'),
        amounts=None))


    TRANS_3 = Transaction(
        date=arrow.get(datetime(2013, 2, 20)),
        description='Purchased whatever digg sells for the year')
    TRANS_3.add_posting(Posting(
        account=('Asset', 'Bitcoin Wallet'),
        amounts={None: -10.0}))
    TRANS_3.add_posting(Posting(
        account=('Expense', 'Web Services', 'Digg'),
        amounts=None))


    TRANS_4 = Transaction(
        date=arrow.get(datetime(2013, 2, 20)),
        description='I owe Joe a favor')
    TRANS_4.add_posting(Posting(
        account=('Payable', 'Joe', 'Favor'),
        amounts={USD: -10.0}))
    TRANS_4.add_posting(Posting(
        account=('Expense', 'Favor'),
        amounts=None))


    TRANS_5 = Transaction(
        date=arrow.get(datetime(2013, 2, 20)),
        description='Traded some cards')
    TRANS_5.add_posting(Posting(
        account=('Asset', 'Pokemon Cards'),
        amounts={None: -10.0}))
    TRANS_5.add_posting(Posting(
        account=('Asset', 'MTG Cards'),
        amounts=None))

    return [TRANS_1, TRANS_2, TRANS_3, TRANS_4, TRANS_5]