diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2016-01-27 10:44:41 +0100 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2019-12-05 15:06:44 +0100 |
commit | e1bba5d977a8b9385e9ffdb05861833485003d23 (patch) | |
tree | 40876bb3d289ced0fd871e94cc9e79c9e934327b /test/regress | |
parent | e264eb618b8eabf9670084f40687af916a63567e (diff) | |
download | fork-ledger-e1bba5d977a8b9385e9ffdb05861833485003d23.tar.gz fork-ledger-e1bba5d977a8b9385e9ffdb05861833485003d23.tar.bz2 fork-ledger-e1bba5d977a8b9385e9ffdb05861833485003d23.zip |
Make tests scripts Python 3 compatible
Diffstat (limited to 'test/regress')
-rw-r--r-- | test/regress/4D9288AE.py | 4 | ||||
-rw-r--r-- | test/regress/78AB4B87.py | 18 | ||||
-rw-r--r-- | test/regress/9188F587.py | 18 | ||||
-rw-r--r-- | test/regress/B21BF389.py | 6 | ||||
-rw-r--r-- | test/regress/BF3C1F82-2.test | 2 | ||||
-rw-r--r-- | test/regress/BF3C1F82.test | 2 | ||||
-rw-r--r-- | test/regress/xact_code.py | 4 |
7 files changed, 35 insertions, 19 deletions
diff --git a/test/regress/4D9288AE.py b/test/regress/4D9288AE.py index 4f9c9ba9..20ba566b 100644 --- a/test/regress/4D9288AE.py +++ b/test/regress/4D9288AE.py @@ -1,4 +1,6 @@ +from __future__ import print_function + import ledger for post in ledger.read_journal("test/regress/4D9288AE.dat").query("^expenses:"): - print post.cost + print(post.cost) diff --git a/test/regress/78AB4B87.py b/test/regress/78AB4B87.py index fed95b54..affc3496 100644 --- a/test/regress/78AB4B87.py +++ b/test/regress/78AB4B87.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import ledger eur = ledger.commodities.find_or_create('EUR') @@ -7,8 +9,8 @@ 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 + print(post.amount) + print(post.amount.commodity) if post.amount.commodity == "EUR": total_eur += post.amount elif post.amount.commodity == "GBP": @@ -16,12 +18,12 @@ for post in ledger.read_journal("test/regress/78AB4B87.dat").query("^income:"): a = post.amount.value(eur) if a: - print "Total is presently: (%s)" % total - print "Converted to EUR: (%s)" % a + print("Total is presently: (%s)" % total) + print("Converted to EUR: (%s)" % a) total += a - print "Total is now: (%s)" % total + print("Total is now: (%s)" % total) else: - print "Cannot convert '%s'" % post.amount - print + print("Cannot convert '%s'" % post.amount) + print() -print total +print(total) diff --git a/test/regress/9188F587.py b/test/regress/9188F587.py index 50195252..9095d58c 100644 --- a/test/regress/9188F587.py +++ b/test/regress/9188F587.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import ledger eur = ledger.commodities.find_or_create('EUR') @@ -7,8 +9,8 @@ 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 + print(post.amount) + print(post.amount.commodity) if post.amount.commodity == "EUR": total_eur += post.amount elif post.amount.commodity == "GBP": @@ -16,12 +18,12 @@ for post in ledger.read_journal("test/regress/78AB4B87.dat").query("^income:"): a = post.amount.value(eur, post.date) if a: - print "Total is presently: (%s)" % total - print "Converted to EUR: (%s)" % a + print("Total is presently: (%s)" % total) + print("Converted to EUR: (%s)" % a) total += a - print "Total is now: (%s)" % total + print("Total is now: (%s)" % total) else: - print "Cannot convert '%s'" % post.amount - print + print("Cannot convert '%s'" % post.amount) + print() -print total +print(total) diff --git a/test/regress/B21BF389.py b/test/regress/B21BF389.py index 707ce340..a49c498c 100644 --- a/test/regress/B21BF389.py +++ b/test/regress/B21BF389.py @@ -3,7 +3,11 @@ from __future__ import print_function, unicode_literals +import sys import ledger for post in ledger.read_journal(__file__.replace(".py", "_py.test")).query("income"): - print(unicode(post.tag("Reference"))) + reference = post.tag("Reference") + if sys.version_info.major == 2: + reference = unicode(reference) + print(reference) diff --git a/test/regress/BF3C1F82-2.test b/test/regress/BF3C1F82-2.test index 94d59e4d..a7808504 100644 --- a/test/regress/BF3C1F82-2.test +++ b/test/regress/BF3C1F82-2.test @@ -1,10 +1,12 @@ ; Check that include directives are relative for "-f /dev/stdin" include non-existent-ledger-file-BF3C1F82 + test -f - reg -> 1 __ERROR__ While parsing file "", line 2: Error: File to include was not found: "./non-existent-ledger-file-BF3C1F82" end test + test -f /dev/stdin reg -> 1 __ERROR__ While parsing file "", line 2: diff --git a/test/regress/BF3C1F82.test b/test/regress/BF3C1F82.test index 9d4937bb..830a43fc 100644 --- a/test/regress/BF3C1F82.test +++ b/test/regress/BF3C1F82.test @@ -3,6 +3,7 @@ 2012/02/30 * Test a 1 b + test -f - reg -> 1 __ERROR__ While parsing file "", line 3: @@ -10,6 +11,7 @@ While parsing transaction: <no source context> Error: Day of month is not valid for year end test + test -f /dev/stdin reg -> 1 __ERROR__ While parsing file "", line 3: diff --git a/test/regress/xact_code.py b/test/regress/xact_code.py index 64abb17d..a697e156 100644 --- a/test/regress/xact_code.py +++ b/test/regress/xact_code.py @@ -1,4 +1,6 @@ +from __future__ import print_function + import ledger for post in ledger.read_journal('test/regress/xact_code.dat').query('expenses'): - print post.xact.code + print(post.xact.code) |