You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by xd...@apache.org on 2020/08/22 08:43:59 UTC

[airflow] branch master updated: Use assertEqual instead of assertTrue in tests/utils/test_dates.py for proper diff (#10457)

This is an automated email from the ASF dual-hosted git repository.

xddeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 44a36b9  Use assertEqual instead of assertTrue in tests/utils/test_dates.py for proper diff (#10457)
44a36b9 is described below

commit 44a36b9ab30d4bc65f8ee99133601449acebd29f
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Sat Aug 22 09:43:26 2020 +0100

    Use assertEqual instead of assertTrue in tests/utils/test_dates.py for proper diff (#10457)
    
    assertEqual will show show the proper diff instead of just "False is not True" error
---
 tests/utils/test_dates.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tests/utils/test_dates.py b/tests/utils/test_dates.py
index eeb5039..c2f0f7b 100644
--- a/tests/utils/test_dates.py
+++ b/tests/utils/test_dates.py
@@ -30,14 +30,13 @@ class TestDates(unittest.TestCase):
         today = pendulum.today()
         today_midnight = pendulum.instance(datetime.fromordinal(today.date().toordinal()))
 
-        self.assertTrue(dates.days_ago(0) == today_midnight)
+        self.assertEqual(dates.days_ago(0), today_midnight)
+        self.assertEqual(dates.days_ago(100), today_midnight + timedelta(days=-100))
 
-        self.assertTrue(dates.days_ago(100) == today_midnight + timedelta(days=-100))
-
-        self.assertTrue(dates.days_ago(0, hour=3) == today_midnight + timedelta(hours=3))
-        self.assertTrue(dates.days_ago(0, minute=3) == today_midnight + timedelta(minutes=3))
-        self.assertTrue(dates.days_ago(0, second=3) == today_midnight + timedelta(seconds=3))
-        self.assertTrue(dates.days_ago(0, microsecond=3) == today_midnight + timedelta(microseconds=3))
+        self.assertEqual(dates.days_ago(0, hour=3), today_midnight + timedelta(hours=3))
+        self.assertEqual(dates.days_ago(0, minute=3), today_midnight + timedelta(minutes=3))
+        self.assertEqual(dates.days_ago(0, second=3), today_midnight + timedelta(seconds=3))
+        self.assertEqual(dates.days_ago(0, microsecond=3), today_midnight + timedelta(microseconds=3))
 
     def test_parse_execution_date(self):
         execution_date_str_wo_ms = '2017-11-02 00:00:00'