gnucash maint: Add test for Transaction GetDate() in python bindings.
John Ralls
jralls at code.gnucash.org
Fri Sep 10 16:28:09 EDT 2021
Updated via https://github.com/Gnucash/gnucash/commit/fcab2982 (commit)
from https://github.com/Gnucash/gnucash/commit/cd0d50aa (commit)
commit fcab298245f39318cc7151ee86ef985ec9d39489
Author: John Ralls <jralls at ceridwen.us>
Date: Fri Sep 10 13:26:59 2021 -0700
Add test for Transaction GetDate() in python bindings.
Pursuant to Bug 798284.
diff --git a/bindings/python/tests/test_transaction.py b/bindings/python/tests/test_transaction.py
index 78e792156..529390f31 100644
--- a/bindings/python/tests/test_transaction.py
+++ b/bindings/python/tests/test_transaction.py
@@ -2,6 +2,7 @@ from unittest import main
from gnucash import Transaction, Book, Account, Split
from unittest_support import *
+from datetime import datetime, timezone
from test_book import BookSession
@@ -138,5 +139,12 @@ class TestTransaction(TransactionSession):
self.trans.SetNotes(NOTE)
self.assertEqual( NOTE, self.trans.GetNotes() )
+ def test_date(self):
+ ZERODATE=datetime.fromisoformat('1970-01-01 00:00:00 +00:00')
+ DATE=datetime.fromisoformat('2020-02-20 10:59:00 +00:00')
+ self.assertEqual(ZERODATE, self.trans.GetDate().astimezone(timezone.utc))
+ self.trans.SetDate(DATE.day, DATE.month, DATE.year)
+ self.assertEqual(DATE, self.trans.GetDate().astimezone(timezone.utc))
+
if __name__ == '__main__':
main()
Summary of changes:
bindings/python/tests/test_transaction.py | 8 ++++++++
1 file changed, 8 insertions(+)
More information about the gnucash-changes
mailing list