Add new -today-in-history, -month, -day, and -year search filters (#1145)

* Introduce -reminisce, -month, -day, and -year
* Update expected_args in parse_args tests
* Add check before creating compare_d
* Misc changes
* Implement testing for -month, -day, -year, and -reminisce
* Compress tests into one Scenario Outline
* Fix failing tests by updating dates_similar journal
* Create 'we set current date and time to' step
* Use time.parse in reminisce
* Update dates_similar journal
* Make 'Searching in a journal' test shorter
* Lint
* Implement reminiscing test
* Add combination tests
* Finalize tests
* Finalize pytests
* Simplify reminisce tests
* Change reminsice help (since it also shows today's entries)
* Re-do tests; use various tests
* Remove old test data
* Better scenario description
* Standardize format for compare_d
* Rename -reminisce to -today-in-history
This commit is contained in:
Karim Rahal 2021-01-17 00:55:27 +02:00 committed by GitHub
parent 18058c74e5
commit f0e8fa2060
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 184 additions and 0 deletions

View file

@ -18,6 +18,10 @@ def expected_args(**kwargs):
"delete": False,
"edit": False,
"end_date": None,
"today_in_history": False,
"month": None,
"day": None,
"year": None,
"excluded": [],
"export": False,
"filename": None,
@ -147,6 +151,27 @@ def test_on_date_alone():
assert cli_as_dict("-on 'saturday'") == expected_args(on_date="saturday")
def test_month_alone():
assert cli_as_dict("-month 1") == expected_args(month="1")
assert cli_as_dict("-month 01") == expected_args(month="01")
assert cli_as_dict("-month January") == expected_args(month="January")
assert cli_as_dict("-month Jan") == expected_args(month="Jan")
def test_day_alone():
assert cli_as_dict("-day 1") == expected_args(day="1")
assert cli_as_dict("-day 01") == expected_args(day="01")
def test_year_alone():
assert cli_as_dict("-year 2021") == expected_args(year="2021")
assert cli_as_dict("-year 21") == expected_args(year="21")
def test_today_in_history_alone():
assert cli_as_dict("-today-in-history") == expected_args(today_in_history=True)
def test_short_alone():
assert cli_as_dict("--short") == expected_args(short=True)