#431: WebSearch: fix test case searching by date 1976-04-01 and t dog
-----------------------+----------------------------------------------------
Reporter: simko | Owner: jblayloc
Type: defect | Status: new
Priority: major | Milestone: v1.0
Component: WebSearch | Version:
Keywords: |
-----------------------+----------------------------------------------------
When `python-dateutil` is not installed, the following test case
fails:
{{{
======================================================================
FAIL: SPIRES search syntax - searching by date 1976-04-01 and t dog
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/opt/python2.4/lib/python2.4/site-
packages/invenio/search_engine_query_parser_tests.py",
line 535, in test_date_by_yr_mo_day_wholemonth_and_suffix
self._compare_searches(inv_search, spi_search)
File
"/opt/python2.4/lib/python2.4/site-
packages/invenio/search_engine_query_parser_tests.py",
line 328, in _compare_searches
assert result_obtained == result_wanted, \
AssertionError: SPIRES parsed as [['+', '1976-04-01', 'year', 'w'],
['+', 'dog', 'title', 'w']] instead of [['+', '1976-04', 'year', 'w'],
['+', 'dog', 'title', 'w']]
}}}
When `python-dateutil` is installed, the test works.
This test was introduced in dc864c5b8c2205b3e43e14fb87beadc5743e5411.
It seems strange that 1976-04-01 should get interpreted as
1976-04 (day interpreted as month, as it were) when `python-dateutil`
is installed, and kept unchanged otherwise. Joe, was the day/month
interpretation really wanted this way due to SPIRES syntax
compatibility or something?
If yes, then we should probably (1) document this and emit visible
warning to the user if they search for such a string; (2) execute the
test case only when the python-dateutil is installed.
If not, then we should fix it.
--
Ticket URL: <http://invenio-software.org/ticket/431>
Invenio <http://invenio-software.org>