|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 |
|
3 | 3 | from datetime import date |
4 | | -from pendulum import Date |
| 4 | +from pendulum import Date, Pendulum |
5 | 5 |
|
6 | 6 | from .. import AbstractTestCase |
7 | 7 |
|
@@ -157,8 +157,12 @@ def test_diff_for_humans_now_and_nearly_future_month(self): |
157 | 157 | self.assertEqual('3 weeks from now', Date.today().add(weeks=3).diff_for_humans()) |
158 | 158 |
|
159 | 159 | def test_diff_for_humans_now_and_future_month(self): |
160 | | - self.assertEqual('4 weeks from now', Date.today().add(weeks=4).diff_for_humans()) |
161 | | - self.assertEqual('1 month from now', Date.today().add(months=1).diff_for_humans()) |
| 160 | + with self.wrap_with_test_now(Pendulum.create(2016, 3, 1)): |
| 161 | + self.assertEqual('4 weeks from now', Date.today().add(weeks=4).diff_for_humans()) |
| 162 | + self.assertEqual('1 month from now', Date.today().add(months=1).diff_for_humans()) |
| 163 | + |
| 164 | + with self.wrap_with_test_now(Pendulum.create(2017, 1, 31)): |
| 165 | + self.assertEqual('1 month from now', Date.today().add(weeks=4).diff_for_humans()) |
162 | 166 |
|
163 | 167 | def test_diff_for_humans_now_and_future_months(self): |
164 | 168 | self.assertEqual('2 months from now', Date.today().add(months=2).diff_for_humans()) |
@@ -191,8 +195,12 @@ def test_diff_for_humans_other_and_nearly_month(self): |
191 | 195 | self.assertEqual('3 weeks before', Date.today().diff_for_humans(Date.today().add(weeks=3))) |
192 | 196 |
|
193 | 197 | def test_diff_for_humans_other_and_month(self): |
194 | | - self.assertEqual('4 weeks before', Date.today().diff_for_humans(Date.today().add(weeks=4))) |
195 | | - self.assertEqual('1 month before', Date.today().diff_for_humans(Date.today().add(months=1))) |
| 198 | + with self.wrap_with_test_now(Pendulum.create(2016, 3, 1)): |
| 199 | + self.assertEqual('4 weeks before', Date.today().diff_for_humans(Date.today().add(weeks=4))) |
| 200 | + self.assertEqual('1 month before', Date.today().diff_for_humans(Date.today().add(months=1))) |
| 201 | + |
| 202 | + with self.wrap_with_test_now(Pendulum.create(2017, 1, 31)): |
| 203 | + self.assertEqual('1 month before', Date.today().diff_for_humans(Date.today().add(weeks=4))) |
196 | 204 |
|
197 | 205 | def test_diff_for_humans_other_and_months(self): |
198 | 206 | self.assertEqual('2 months before', Date.today().diff_for_humans(Date.today().add(months=2))) |
|
0 commit comments