fix: add yesterday as special case

This commit is contained in:
Mahdi Dibaiee 2018-01-14 14:53:56 +03:30
parent 981d7eeda0
commit c6ff971246
2 changed files with 2 additions and 1 deletions

View File

@ -44,7 +44,7 @@ symbols = ['!', ',', '@', '#', '$', '%', '^', '&', '*', '?']
transformations = [dict(zip((x + 's' for x in multipliers.keys()), multipliers.keys()))]
transformations.append(dict(zip(direction.keys(), (x + ' ' + '1' for x in direction.keys()))))
transformations.append({ 'tomorrow': 'next day' })
transformations.append({ 'tomorrow': 'next day', 'yesterday': 'past 1 day' })
transformations.append({ 'next': '1', 'upcoming': '1', 'following': '1', 'a': '1', 'an': '1' })
keywords = list(multipliers.keys()) + months + months_short + years + days + days_short + list(direction.keys()) + [time_prefix] + time_postfix

View File

@ -99,6 +99,7 @@ class HumanDateTests(unittest.TestCase):
'a week ago': self.today - timedelta(days=7),
'a month ago': self.today - timedelta(days=30),
'a year past': self.today - timedelta(days=365),
'yesterday': self.today - timedelta(days=1),
}
for (k, date) in tests.items():