summaryrefslogtreecommitdiff
path: root/test/regress/78AB4B87.py
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-30 00:43:48 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-30 00:51:06 -0500
commitbf66abc258ee70de5bd5510301795168f46929f8 (patch)
treeb42268a39724286ae4b6f5f4e840ac6b470a39fc /test/regress/78AB4B87.py
parent413a392aa99e8ff225d00d4e07d7370797ef4d88 (diff)
downloadfork-ledger-bf66abc258ee70de5bd5510301795168f46929f8.tar.gz
fork-ledger-bf66abc258ee70de5bd5510301795168f46929f8.tar.bz2
fork-ledger-bf66abc258ee70de5bd5510301795168f46929f8.zip
Added another Python support regression test
Diffstat (limited to 'test/regress/78AB4B87.py')
-rw-r--r--test/regress/78AB4B87.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/regress/78AB4B87.py b/test/regress/78AB4B87.py
new file mode 100644
index 00000000..fed95b54
--- /dev/null
+++ b/test/regress/78AB4B87.py
@@ -0,0 +1,27 @@
+import ledger
+
+eur = ledger.commodities.find_or_create('EUR')
+
+total_eur = ledger.Amount("0.00 EUR")
+total_gbp = ledger.Amount("0.00 GBP")
+total = ledger.Amount("0.00 EUR")
+
+for post in ledger.read_journal("test/regress/78AB4B87.dat").query("^income:"):
+ print post.amount
+ print post.amount.commodity
+ if post.amount.commodity == "EUR":
+ total_eur += post.amount
+ elif post.amount.commodity == "GBP":
+ total_gbp += post.amount
+
+ a = post.amount.value(eur)
+ if a:
+ print "Total is presently: (%s)" % total
+ print "Converted to EUR: (%s)" % a
+ total += a
+ print "Total is now: (%s)" % total
+ else:
+ print "Cannot convert '%s'" % post.amount
+ print
+
+print total