| 156 | |
| 157 | |
| 158 | def test_is_birthday(): # backward compatibility |
| 159 | d = pendulum.Date.today() |
| 160 | an_anniversary = d.subtract(years=1) |
| 161 | assert an_anniversary.is_birthday() |
| 162 | not_an_anniversary = d.subtract(days=1) |
| 163 | assert not not_an_anniversary.is_birthday() |
| 164 | also_not_an_anniversary = d.add(days=2) |
| 165 | assert not also_not_an_anniversary.is_birthday() |
| 166 | |
| 167 | d1 = pendulum.Date(1987, 4, 23) |
| 168 | d2 = pendulum.Date(2014, 9, 26) |
| 169 | d3 = pendulum.Date(2014, 4, 23) |
| 170 | assert not d2.is_birthday(d1) |
| 171 | assert d3.is_birthday(d1) |
| 172 | |
| 173 | |
| 174 | def test_closest(): |