gnucash maint: Fix python transaction test_date on Ubuntu-81.04.

John Ralls jralls at code.gnucash.org
Fri Sep 10 20:02:47 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/b8552a80 (commit)
	from  https://github.com/Gnucash/gnucash/commit/a310b72b (commit)



commit b8552a8070325e6815fd9086eb3cacbb3f57612a
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Sep 10 17:01:38 2021 -0700

    Fix python transaction test_date on Ubuntu-81.04.
    
    Python3 there is too old for fromisoformat, use direct construction
    instead.

diff --git a/bindings/python/tests/test_transaction.py b/bindings/python/tests/test_transaction.py
index 529390f31..446a7b8e4 100644
--- a/bindings/python/tests/test_transaction.py
+++ b/bindings/python/tests/test_transaction.py
@@ -140,8 +140,8 @@ class TestTransaction(TransactionSession):
         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')
+        ZERODATE=datetime(1970, 1, 1, 0, 0, 0, tzinfo=timezone.utc)
+        DATE=datetime(2020, 2, 20, 10, 59, 0, tzinfo=timezone.utc)
         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))



Summary of changes:
 bindings/python/tests/test_transaction.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list